[Mesa-dev] Build with optimization + debug and 'Mesa errors' messages
After commit 122345876 there is no way to change compiler optimization flag on a debug build, since -O0 gets added after your CFLAGS. Can this be changed? Also it would be nice to always enable, also on non debug builds, the messages about Mesa errors in output_if_debug. It can be enabled with MESA_DEBUG env var, but having it enabled by default could help to detect possible problems, it also won't spam too much the console since it can detect and report duplicate messages without printing it every time. ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nv50/codegen/nv50_ir.cpp: #include on -DNDEBUG.
On 31.12.2012 04:21, Johannes Obermayr wrote: > Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=58879 > --- > On debug builds it is included: > nv50_ir.cpp:23 -> nv50_ir.h:33 -> nv50_ir_util.h:33 -> And on non-debug builds it's supposed to *not* be included, because they should work without rtti. Since when are assertions not removed when NDEBUG is defined ? > --- > src/gallium/drivers/nv50/codegen/nv50_ir.cpp |4 > 1 Datei geändert, 4 Zeilen hinzugefügt(+) > > diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp > b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp > index 335e9e0..0bce2ce 100644 > --- a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp > +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp > @@ -24,6 +24,10 @@ > #include "nv50_ir_target.h" > #include "nv50_ir_driver.h" > > +#ifdef NDEBUG > +# include > +#endif > + > extern "C" { > #include "nv50/nv50_program.h" > #include "nv50/nv50_debug.h" ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] nv50/codegen/nv50_ir.cpp: #include on -DNDEBUG.
On 31.12.2012 14:01, Christoph Bumiller wrote: > On 31.12.2012 04:21, Johannes Obermayr wrote: >> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=58879 >> --- >> On debug builds it is included: >> nv50_ir.cpp:23 -> nv50_ir.h:33 -> nv50_ir_util.h:33 -> > And on non-debug builds it's supposed to *not* be included, because they > should work without rtti. > Since when are assertions not removed when NDEBUG is defined ? > Ok I get it, it's implemented as do { } while(0 && condition) ... Let's just wrap that assertion in #ifndef NDEBUG then. >> --- >> src/gallium/drivers/nv50/codegen/nv50_ir.cpp |4 >> 1 Datei geändert, 4 Zeilen hinzugefügt(+) >> >> diff --git a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp >> b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp >> index 335e9e0..0bce2ce 100644 >> --- a/src/gallium/drivers/nv50/codegen/nv50_ir.cpp >> +++ b/src/gallium/drivers/nv50/codegen/nv50_ir.cpp >> @@ -24,6 +24,10 @@ >> #include "nv50_ir_target.h" >> #include "nv50_ir_driver.h" >> >> +#ifdef NDEBUG >> +# include >> +#endif >> + >> extern "C" { >> #include "nv50/nv50_program.h" >> #include "nv50/nv50_debug.h" > ___ > mesa-dev mailing list > mesa-dev@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/mesa-dev > ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure.ac: Save user {C, CXX}FLAGS and append them at end.
On Sun, Dec 23, 2012 at 3:41 AM, Johannes Obermayr wrote: > Am Samstag, 22. Dezember 2012, 16:34:48 schrieben Sie: >> On Sat, Dec 22, 2012 at 10:47 AM, Johannes Obermayr >> wrote: >> > Am Samstag, 22. Dezember 2012, 09:21:33 schrieb Matt Turner: >> >> On Sat, Dec 22, 2012 at 9:16 AM, Johannes Obermayr >> >> wrote: >> >> > This way the user has the privilege of last decision and so the option >> >> > to build an optimized debug build again. >> >> > --- >> >> >> >> You can just do CFLAGS="-g -O2" ./configure can't you? >> > >> > Nope. >> > >> > CXXFLAGS='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 >> > -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g' >> > CFLAGS='-fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector >> > -funwind-tables -fasynchronous-unwind-tables -g' ./autogen.sh >> > --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu >> > --program-prefix= --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin >> > --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share >> > --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/lib >> > --localstatedir=/var --sharedstatedir=/usr/com --mandir=/usr/share/man >> > --infodir=/usr/share/info --disable-dependency-tracking --enable-xvmc >> > --enable-vdpau --enable-texture-float --enable-debug >> > --with-dri-drivers=i915,i965,nouveau,r200,radeon,swrast >> > --with-gallium-drivers=i915,nouveau,r300,r600,svga,swrast --enable-dri >> > --enable-glx --enable-osmesa --enable-gles1 --enable-gles2 --enable-openvg >> > --enable-shared-glapi --enable-shared-gallium --enable-gbm --enable-xa --ena >> > ble-gallium-egl --enable-gallium-llvm --enable-gallium-gbm >> > --enable-opencl --enable-r600-llvm-compiler --enable-gallium-g3dvl >> > --enable-glx-tls >> > >> > Resulting Makefile: >> > before: >> > CFLAGS = -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 >> > -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -Wall >> > -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes >> > -fno-strict-aliasing -fno-builtin-memcmp -g -O0 >> > >> > after: >> > CFLAGS = -Wall -std=c99 -Werror=implicit-function-declaration >> > -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -g -O0 >> > -fmessage-length=0 -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector >> > -funwind-tables -fasynchronous-unwind-tables -g >> > >> > You see configure CFLAGS and initial CFLAGS are vice versa. >> >> The real fix here is not to have configure.ac touch CFLAGS at all like >> any reasonable autotools project. That was an unfortunate shortcut >> during the initial work. That would be a lot more effort, though. > > Initial work after ~ 5 years? > http://cgit.freedesktop.org/mesa/mesa/commit/?id=122345876479cf5cf553e38162ab105658614ab7 Not sure what you mean by this. When I wrote configure.ac however many years ago, I didn't cleanly split off CFLAGS set by mesa from the user's CFLAGS as a shortcut. Looking back now, I should have just bit the bullet and made something like MESA_CFLAGS/MESA_LDFLAGS and made all the Makefiles use that. > Btw: > http://cgit.freedesktop.org/mesa/mesa/commit/?id=ff2efdf5997d20b41f7a82b77118366e6fbd23bc > http://cgit.freedesktop.org/mesa/mesa/commit/?id=33ae29c93b8f70a86dcedc495dd658a5d5679db3 > > This patch covers the motivation for commit 33ae29c. > >> >> However, the typical convention is that the user's CFLAGS come first >> (see any automake COMPILE or LTCOMPILE definition), mostly so that any >> user specified -I paths take precedence. That's unfortunate when -O >> options to gcc are last one wins, but that's how things have typically >> been. I would make this change very cautiously. >> >> -- >> Dan > > And here is the real reason for my request: > > /usr/lib64/mesa-demos/egl/opengl/xeglgears > > AMD Fusion (fps) Nvidia ION (fps) > -O0 -O2 -O0 -O2 > 562,7 750,778 0,33641,851 921,464 0,44 > 701,756 662,877 -0,06 693,752 1000,1960,44 > 571,566 665,052 0,16692,196 936,147 0,35 > 542,715 664,658 0,22693,733 995,499 0,43 > 542,935 664,78 0,22692,702 992,634 0,43 > 542,574 665,398 0,23692,835 998,665 0,44 > 542,945 663,087 0,22691,353 998,319 0,44 > 541,732 664,253 0,23656,32 995,91 0,52 > 543,392 665,078 0,22691,084 994,037 0,44 > 542,901 663,406 0,22693,464 996,858 0,44 > 5635,2166729,3670,196839,29 9829,7290,44 > (sum) > > -> Performance + 19 % on AMD Fusion, + 44 % on Nvidia ION on debug build with > -O2. :-) > > Usual users should build Mesa with default FLAGS. Advanced users should be > able to build it with their own FLAGS without modifying source. Right, --enable-debug is forcing you to have -O0. That's the problem. Mesa should not be overriding user defined flags such as optimization unless it's necessary to get Mesa to bu
Re: [Mesa-dev] [PATCH 1/2] r600g: rework handling of the constants
On Wed, Dec 26, 2012 at 05:38:27PM +0100, Vincent Lejeune wrote: > From Vadim Girlin patch > --- > src/gallium/drivers/r600/r600_llvm.c | 27 +++ > src/gallium/drivers/r600/r600_shader.c | 39 > -- > .../drivers/radeon/radeon_setup_tgsi_llvm.c| 4 +++ > 3 files changed, 54 insertions(+), 16 deletions(-) > > diff --git a/src/gallium/drivers/r600/r600_llvm.c > b/src/gallium/drivers/r600/r600_llvm.c > index 79f6cf0..cae2131 100644 > --- a/src/gallium/drivers/r600/r600_llvm.c > +++ b/src/gallium/drivers/r600/r600_llvm.c > @@ -25,12 +25,19 @@ static LLVMValueRef llvm_fetch_const( > enum tgsi_opcode_type type, > unsigned swizzle) > { > - LLVMValueRef idx = lp_build_const_int32(bld_base->base.gallivm, > - radeon_llvm_reg_index_soa(reg->Register.Index, > swizzle)); > - LLVMValueRef cval = build_intrinsic(bld_base->base.gallivm->builder, > - "llvm.AMDGPU.load.const", bld_base->base.elem_type, > - &idx, 1, LLVMReadNoneAttribute); > - > + LLVMValueRef offset[2] = { > + > LLVMConstInt(LLVMInt64TypeInContext(bld_base->base.gallivm->context), 0, > false), > + lp_build_const_int32(bld_base->base.gallivm, > reg->Register.Index) > + }; > + if (reg->Register.Indirect) { > + struct lp_build_tgsi_soa_context *bld = > lp_soa_context(bld_base); > + LLVMValueRef index = > LLVMBuildLoad(bld_base->base.gallivm->builder, > bld->addr[reg->Indirect.Index][reg->Indirect.SwizzleX], ""); > + offset[1] = LLVMBuildAdd(bld_base->base.gallivm->builder, > offset[1], index, ""); > + } > + LLVMValueRef const_ptr = > LLVMGetFirstGlobal(bld_base->base.gallivm->module); > + LLVMValueRef ptr = LLVMBuildGEP(bld_base->base.gallivm->builder, > const_ptr, offset, 2, ""); > + LLVMValueRef cvecval = LLVMBuildLoad(bld_base->base.gallivm->builder, > ptr, ""); > + LLVMValueRef cval = > LLVMBuildExtractElement(bld_base->base.gallivm->builder, cvecval, > lp_build_const_int32(bld_base->base.gallivm, swizzle), ""); > return bitcast(bld_base, type, cval); > } I thought it would be possible to implement this without using global addresses by passing the offset as a pointer to the backend and letting the backend figure out how to translate it into a kcache address. Can you explain why we are using global variables here? -Tom > > @@ -449,6 +456,14 @@ LLVMModuleRef r600_tgsi_llvm( > bld_base->op_actions[TGSI_OPCODE_TXP].emit = llvm_emit_tex; > bld_base->op_actions[TGSI_OPCODE_CMP].emit = emit_cndlt; > > + // Generate const buffer pointers > + for (unsigned i = 0; i < 16; i++) { > + char name[8]; > + sprintf(name, "const%d", i); > + LLVMTypeRef type = > LLVMArrayType(LLVMVectorType(bld_base->base.elem_type, 4), 1024); > + LLVMAddGlobalInAddressSpace(bld_base->base.gallivm->module, > type, name, 2); > + } > + > lp_build_tgsi_llvm(bld_base, tokens); > > radeon_llvm_finalize_module(ctx); > diff --git a/src/gallium/drivers/r600/r600_shader.c > b/src/gallium/drivers/r600/r600_shader.c > index ac28d22..f8eadd3 100644 > --- a/src/gallium/drivers/r600/r600_shader.c > +++ b/src/gallium/drivers/r600/r600_shader.c > @@ -299,15 +299,21 @@ static unsigned r600_src_from_byte_stream(unsigned char > * bytes, > static unsigned r600_alu_from_byte_stream(struct r600_shader_ctx *ctx, > unsigned char * bytes, unsigned bytes_read) > { > - unsigned src_idx; > + unsigned src_idx, src_num; > struct r600_bytecode_alu alu; > - unsigned src_const_reg[3]; > + unsigned src_use_sel[3]; > + unsigned src_sel[3] = {}; > uint32_t word0, word1; > - > + > + src_num = bytes[bytes_read++]; > + > memset(&alu, 0, sizeof(alu)); > - for(src_idx = 0; src_idx < 3; src_idx++) { > + for(src_idx = 0; src_idx < src_num; src_idx++) { > unsigned i; > - src_const_reg[src_idx] = bytes[bytes_read++]; > + src_use_sel[src_idx] = bytes[bytes_read++]; > + for (i = 0; i < 4; i++) { > + src_sel[src_idx] |= bytes[bytes_read++] << (i * 8); > + } > for (i = 0; i < 4; i++) { > alu.src[src_idx].value |= bytes[bytes_read++] << (i * > 8); > } > @@ -327,9 +333,22 @@ static unsigned r600_alu_from_byte_stream(struct > r600_shader_ctx *ctx, > break; > } > > - for(src_idx = 0; src_idx < 3; src_idx++) { > - if (src_const_reg[src_idx]) > - alu.src[src_idx].sel += 512; > + for(src_idx = 0; src_idx < src_num; src_idx++) { > + if (src_use_sel[src_idx]) { > + unsigned sel = src_sel[src_idx]; > + > + alu.src[src_idx].chan = sel & 3; > + sel >>= 2; > +
Re: [Mesa-dev] [PATCH 1/2] r600g: rework handling of the constants
Le dimanche 30 décembre 2012 à 10:29 -0500, Tom Stellard a écrit : > On Wed, Dec 26, 2012 at 05:38:27PM +0100, Vincent Lejeune wrote: > > From Vadim Girlin patch > > --- > > src/gallium/drivers/r600/r600_llvm.c | 27 +++ > > src/gallium/drivers/r600/r600_shader.c | 39 > > -- > > .../drivers/radeon/radeon_setup_tgsi_llvm.c| 4 +++ > > 3 files changed, 54 insertions(+), 16 deletions(-) > > > > diff --git a/src/gallium/drivers/r600/r600_llvm.c > > b/src/gallium/drivers/r600/r600_llvm.c > > index 79f6cf0..cae2131 100644 > > --- a/src/gallium/drivers/r600/r600_llvm.c > > +++ b/src/gallium/drivers/r600/r600_llvm.c > > @@ -25,12 +25,19 @@ static LLVMValueRef llvm_fetch_const( > > enum tgsi_opcode_type type, > > unsigned swizzle) > > { > > - LLVMValueRef idx = lp_build_const_int32(bld_base->base.gallivm, > > - radeon_llvm_reg_index_soa(reg->Register.Index, > > swizzle)); > > - LLVMValueRef cval = build_intrinsic(bld_base->base.gallivm->builder, > > - "llvm.AMDGPU.load.const", bld_base->base.elem_type, > > - &idx, 1, LLVMReadNoneAttribute); > > - > > + LLVMValueRef offset[2] = { > > + > > LLVMConstInt(LLVMInt64TypeInContext(bld_base->base.gallivm->context), 0, > > false), > > + lp_build_const_int32(bld_base->base.gallivm, > > reg->Register.Index) > > + }; > > + if (reg->Register.Indirect) { > > + struct lp_build_tgsi_soa_context *bld = > > lp_soa_context(bld_base); > > + LLVMValueRef index = > > LLVMBuildLoad(bld_base->base.gallivm->builder, > > bld->addr[reg->Indirect.Index][reg->Indirect.SwizzleX], ""); > > + offset[1] = LLVMBuildAdd(bld_base->base.gallivm->builder, > > offset[1], index, ""); > > + } > > + LLVMValueRef const_ptr = > > LLVMGetFirstGlobal(bld_base->base.gallivm->module); > > + LLVMValueRef ptr = LLVMBuildGEP(bld_base->base.gallivm->builder, > > const_ptr, offset, 2, ""); > > + LLVMValueRef cvecval = LLVMBuildLoad(bld_base->base.gallivm->builder, > > ptr, ""); > > + LLVMValueRef cval = > > LLVMBuildExtractElement(bld_base->base.gallivm->builder, cvecval, > > lp_build_const_int32(bld_base->base.gallivm, swizzle), ""); > > return bitcast(bld_base, type, cval); > > } > > I thought it would be possible to implement this without using global > addresses by passing the offset as a pointer to the backend and letting > the backend figure out how to translate it into a kcache address. > Can you explain why we are using global variables here? > > -Tom The main drawback from the offset as a pointer solution is that it does not allow to handle multiple const buffers read. R600g already needs to fetch value from non-default const buffer for clip vertex ; it currently appends some alus to llvm backend output but this part would better fit inside the backend IMHO. I use global variable because it allows to name pointers and thus to associate a const buffer id with a name (actually "const0" stands for the default const buffer, "const1" is for the second const buffer, and so on). I don't really use the fact it is a global variable inside the backend, in fact any named pointer marked as external could fit (iirc the "external symbol" llvm value could be used too ). Global variables purpose is to model address (function and/or variables) whose value is know at compile time, whereas ExternalSymbol is for address whose value is only know at link time. Vincent > > > > > @@ -449,6 +456,14 @@ LLVMModuleRef r600_tgsi_llvm( > > bld_base->op_actions[TGSI_OPCODE_TXP].emit = llvm_emit_tex; > > bld_base->op_actions[TGSI_OPCODE_CMP].emit = emit_cndlt; > > > > + // Generate const buffer pointers > > + for (unsigned i = 0; i < 16; i++) { > > + char name[8]; > > + sprintf(name, "const%d", i); > > + LLVMTypeRef type = > > LLVMArrayType(LLVMVectorType(bld_base->base.elem_type, 4), 1024); > > + LLVMAddGlobalInAddressSpace(bld_base->base.gallivm->module, > > type, name, 2); > > + } > > + > > lp_build_tgsi_llvm(bld_base, tokens); > > > > radeon_llvm_finalize_module(ctx); > > diff --git a/src/gallium/drivers/r600/r600_shader.c > > b/src/gallium/drivers/r600/r600_shader.c > > index ac28d22..f8eadd3 100644 > > --- a/src/gallium/drivers/r600/r600_shader.c > > +++ b/src/gallium/drivers/r600/r600_shader.c > > @@ -299,15 +299,21 @@ static unsigned r600_src_from_byte_stream(unsigned > > char * bytes, > > static unsigned r600_alu_from_byte_stream(struct r600_shader_ctx *ctx, > > unsigned char * bytes, unsigned bytes_read) > > { > > - unsigned src_idx; > > + unsigned src_idx, src_num; > > struct r600_bytecode_alu alu; > > - unsigned src_const_reg[3]; > > + unsigned src_use_sel[3]; > > + unsigned src_sel[3] = {}; > > uint32_t word0, word1; > > - > > + > > + src_num = bytes[bytes_read++]; > > + > > memset(&alu,
[Mesa-dev] [PATCH 1/2] mesa: Fix error reporting in _mesa_invalidate_pbo_{compressed_, }teximage.
The old error reporting was completely bogus, passing _mesa_error() a format string that didn't even match the remaining arguments. Also, in many cases the number of dimensions in the TexImage call was not preserved in the error message (e.g. an error in glTexImage2D was reported simply as an error in glTexImage). --- src/mesa/drivers/dri/nouveau/nouveau_texture.c | 4 ++-- src/mesa/main/pbo.c| 15 ++- src/mesa/main/pbo.h| 3 ++- src/mesa/main/texstore.c | 4 ++-- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c index 288b510..64cd23b 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c +++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c @@ -501,7 +501,7 @@ nouveau_teximage(struct gl_context *ctx, GLint dims, if (compressed) pixels = _mesa_validate_pbo_compressed_teximage(ctx, - imageSize, + dims, imageSize, pixels, packing, "glCompressedTexImage"); else pixels = _mesa_validate_pbo_teximage(ctx, @@ -576,7 +576,7 @@ nouveau_texsubimage(struct gl_context *ctx, GLint dims, if (compressed) pixels = _mesa_validate_pbo_compressed_teximage(ctx, - imageSize, + dims, imageSize, pixels, packing, "glCompressedTexSubImage"); else pixels = _mesa_validate_pbo_teximage(ctx, diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c index c73d749..0dc4c04 100644 --- a/src/mesa/main/pbo.c +++ b/src/mesa/main/pbo.c @@ -342,7 +342,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions, } if (!_mesa_validate_pbo_access(dimensions, unpack, width, height, depth, format, type, INT_MAX, pixels)) { - _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(invalid PBO access)", + funcName, dimensions); return NULL; } @@ -351,7 +352,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions, GL_MAP_READ_BIT, unpack->BufferObj); if (!buf) { - _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(PBO is mapped)", funcName, + dimensions); return NULL; } @@ -368,7 +370,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions, */ const GLvoid * _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx, - GLsizei imageSize, const GLvoid *pixels, + GLuint dimensions, GLsizei imageSize, + const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, const char *funcName) { @@ -381,7 +384,8 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx, if ((const GLubyte *) pixels + imageSize > ((const GLubyte *) 0) + packing->BufferObj->Size) { /* out of bounds read! */ - _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(invalid PBO access)"); + _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(invalid PBO access)", + funcName, dimensions); return NULL; } @@ -390,7 +394,8 @@ _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx, GL_MAP_READ_BIT, packing->BufferObj); if (!buf) { - _mesa_error(ctx, GL_INVALID_OPERATION, funcName, "(PBO is mapped"); + _mesa_error(ctx, GL_INVALID_OPERATION, "%s%uD(PBO is mapped)", funcName, + dimensions); return NULL; } diff --git a/src/mesa/main/pbo.h b/src/mesa/main/pbo.h index 00a6e61..9eba335 100644 --- a/src/mesa/main/pbo.h +++ b/src/mesa/main/pbo.h @@ -81,7 +81,8 @@ _mesa_validate_pbo_teximage(struct gl_context *ctx, GLuint dimensions, extern const GLvoid * _mesa_validate_pbo_compressed_teximage(struct gl_context *ctx, -GLsizei imageSize, const GLvoid *pixels, +GLuint dimensions, GLsizei imageSize, +const GLvoid *pixels, const struct gl_pixelstore_attrib *packing, const char *funcName); diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 26c5b67..8669898 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -4496,9 +4496,9 @@ _mesa_store_compr
[Mesa-dev] [PATCH 2/2] mesa: Implement compressed 2D array textures.
This patch adds functionality to Mesa to upload compressed 2-dimensional array textures, using the glCompressedTexImage3D and glCompressedTexSubImage3D calls. Fixes piglit tests "EXT_texture_array/compressed *" and "!OpenGL ES 3.0/ext_texture_array-compressed_gles3 *". Also partially fixes GLES3 conformance test "CoverageES30.test". --- Note that in order for the piglit tests "!OpenGL ES 3.0/ext_texture_array-compressed_gles3 *" to pass, patch "i965: Fix glCompressedTexSubImage2D offsets for ETC textures." also needs to be applied. src/mesa/main/teximage.c | 16 +- src/mesa/main/texstore.c | 54 ++-- 2 files changed, 40 insertions(+), 30 deletions(-) diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 7a0d944..33f81a2 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -3507,7 +3507,8 @@ compressed_subtexture_error_check(struct gl_context *ctx, GLint dims, GLint expectedSize; GLboolean targetOK; - if (dims == 2) { + switch (dims) { + case 2: switch (target) { case GL_TEXTURE_2D: case GL_TEXTURE_CUBE_MAP_POSITIVE_X: @@ -3520,12 +3521,17 @@ compressed_subtexture_error_check(struct gl_context *ctx, GLint dims, break; default: targetOK = GL_FALSE; + break; } - } - else { - assert(dims == 1 || dims == 3); - /* no 1D or 3D compressed textures at this time */ + break; + case 3: + targetOK = (target == GL_TEXTURE_2D_ARRAY); + break; + default: + assert(dims == 1); + /* no 1D compressed textures at this time */ targetOK = GL_FALSE; + break; } if (!targetOK) { diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 8669898..7511509 100644 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -4441,9 +4441,9 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, struct gl_texture_image *texImage, GLsizei imageSize, const GLvoid *data) { - /* only 2D compressed images are supported at this time */ - if (dims != 2) { - _mesa_problem(ctx, "Unexpected glCompressedTexImage1D/3D call"); + /* only 2D and 3D compressed images are supported at this time */ + if (dims == 1) { + _mesa_problem(ctx, "Unexpected glCompressedTexImage1D call"); return; } @@ -4454,11 +4454,11 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, GLuint dims, ASSERT(texImage); ASSERT(texImage->Width > 0); ASSERT(texImage->Height > 0); - ASSERT(texImage->Depth == 1); + ASSERT(texImage->Depth > 0); /* allocate storage for texture data */ if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) { - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage%uD", dims); return; } @@ -4487,9 +4487,10 @@ _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, const GLubyte *src; const gl_format texFormat = texImage->TexFormat; GLuint bw, bh; + GLuint slice; - if (dims != 2) { - _mesa_problem(ctx, "Unexpected 1D/3D compressed texsubimage call"); + if (dims == 1) { + _mesa_problem(ctx, "Unexpected 1D compressed texsubimage call"); return; } @@ -4505,27 +4506,30 @@ _mesa_store_compressed_texsubimage(struct gl_context *ctx, GLuint dims, srcRowStride = _mesa_format_row_stride(texFormat, width); src = (const GLubyte *) data; - /* Map dest texture buffer */ - ctx->Driver.MapTextureImage(ctx, texImage, 0, - xoffset, yoffset, width, height, - GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT, - &dstMap, &dstRowStride); + for (slice = 0; slice < depth; slice++) { + /* Map dest texture buffer */ + ctx->Driver.MapTextureImage(ctx, texImage, slice + zoffset, + xoffset, yoffset, width, height, + GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_RANGE_BIT, + &dstMap, &dstRowStride); - if (dstMap) { - bytesPerRow = srcRowStride; /* bytes per row of blocks */ - rows = (height + bh - 1) / bh; /* rows in blocks */ + if (dstMap) { + bytesPerRow = srcRowStride; /* bytes per row of blocks */ + rows = (height + bh - 1) / bh; /* rows in blocks */ - /* copy rows of blocks */ - for (i = 0; i < rows; i++) { - memcpy(dstMap, src, bytesPerRow); - dstMap += dstRowStride; - src += srcRowStride; - } + /* copy rows of blocks */ + for (i = 0; i < rows; i++) { +memcpy(dstMap, src, bytesPerRow); +dstMap += dstRowStride; +src += srcRowStride; + } - ctx->Driver.UnmapTextureImage(ctx, texImage, 0);
Re: [Mesa-dev] [PATCH 1/2] mesa: Fix error reporting in _mesa_invalidate_pbo_{compressed_, }teximage.
On Mon, Dec 31, 2012 at 11:18 AM, Paul Berry wrote: > The old error reporting was completely bogus, passing _mesa_error() a > format string that didn't even match the remaining arguments. Also, > in many cases the number of dimensions in the TexImage call was not > preserved in the error message (e.g. an error in glTexImage2D was > reported simply as an error in glTexImage). Ouch. Both are Reviewed-by: Matt Turner ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 2/2] mesa: Implement compressed 2D array textures.
Series Reviewed-by: Jordan Justen On Mon, Dec 31, 2012 at 11:18 AM, Paul Berry wrote: > This patch adds functionality to Mesa to upload compressed > 2-dimensional array textures, using the glCompressedTexImage3D and > glCompressedTexSubImage3D calls. > > Fixes piglit tests "EXT_texture_array/compressed *" and "!OpenGL ES > 3.0/ext_texture_array-compressed_gles3 *". Also partially fixes GLES3 > conformance test "CoverageES30.test". > --- > > Note that in order for the piglit tests "!OpenGL ES > 3.0/ext_texture_array-compressed_gles3 *" to pass, patch "i965: Fix > glCompressedTexSubImage2D offsets for ETC textures." also needs to be > applied. > > src/mesa/main/teximage.c | 16 +- > src/mesa/main/texstore.c | 54 > ++-- > 2 files changed, 40 insertions(+), 30 deletions(-) > > diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c > index 7a0d944..33f81a2 100644 > --- a/src/mesa/main/teximage.c > +++ b/src/mesa/main/teximage.c > @@ -3507,7 +3507,8 @@ compressed_subtexture_error_check(struct gl_context > *ctx, GLint dims, > GLint expectedSize; > GLboolean targetOK; > > - if (dims == 2) { > + switch (dims) { > + case 2: >switch (target) { >case GL_TEXTURE_2D: >case GL_TEXTURE_CUBE_MAP_POSITIVE_X: > @@ -3520,12 +3521,17 @@ compressed_subtexture_error_check(struct gl_context > *ctx, GLint dims, > break; >default: > targetOK = GL_FALSE; > + break; >} > - } > - else { > - assert(dims == 1 || dims == 3); > - /* no 1D or 3D compressed textures at this time */ > + break; > + case 3: > + targetOK = (target == GL_TEXTURE_2D_ARRAY); > + break; > + default: > + assert(dims == 1); > + /* no 1D compressed textures at this time */ >targetOK = GL_FALSE; > + break; > } > > if (!targetOK) { > diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c > index 8669898..7511509 100644 > --- a/src/mesa/main/texstore.c > +++ b/src/mesa/main/texstore.c > @@ -4441,9 +4441,9 @@ _mesa_store_compressed_teximage(struct gl_context *ctx, > GLuint dims, > struct gl_texture_image *texImage, > GLsizei imageSize, const GLvoid *data) > { > - /* only 2D compressed images are supported at this time */ > - if (dims != 2) { > - _mesa_problem(ctx, "Unexpected glCompressedTexImage1D/3D call"); > + /* only 2D and 3D compressed images are supported at this time */ > + if (dims == 1) { > + _mesa_problem(ctx, "Unexpected glCompressedTexImage1D call"); >return; > } > > @@ -4454,11 +4454,11 @@ _mesa_store_compressed_teximage(struct gl_context > *ctx, GLuint dims, > ASSERT(texImage); > ASSERT(texImage->Width > 0); > ASSERT(texImage->Height > 0); > - ASSERT(texImage->Depth == 1); > + ASSERT(texImage->Depth > 0); > > /* allocate storage for texture data */ > if (!ctx->Driver.AllocTextureImageBuffer(ctx, texImage)) { > - _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage2D"); > + _mesa_error(ctx, GL_OUT_OF_MEMORY, "glCompressedTexImage%uD", dims); >return; > } > > @@ -4487,9 +4487,10 @@ _mesa_store_compressed_texsubimage(struct gl_context > *ctx, GLuint dims, > const GLubyte *src; > const gl_format texFormat = texImage->TexFormat; > GLuint bw, bh; > + GLuint slice; > > - if (dims != 2) { > - _mesa_problem(ctx, "Unexpected 1D/3D compressed texsubimage call"); > + if (dims == 1) { > + _mesa_problem(ctx, "Unexpected 1D compressed texsubimage call"); >return; > } > > @@ -4505,27 +4506,30 @@ _mesa_store_compressed_texsubimage(struct gl_context > *ctx, GLuint dims, > srcRowStride = _mesa_format_row_stride(texFormat, width); > src = (const GLubyte *) data; > > - /* Map dest texture buffer */ > - ctx->Driver.MapTextureImage(ctx, texImage, 0, > - xoffset, yoffset, width, height, > - GL_MAP_WRITE_BIT | > GL_MAP_INVALIDATE_RANGE_BIT, > - &dstMap, &dstRowStride); > + for (slice = 0; slice < depth; slice++) { > + /* Map dest texture buffer */ > + ctx->Driver.MapTextureImage(ctx, texImage, slice + zoffset, > + xoffset, yoffset, width, height, > + GL_MAP_WRITE_BIT | > GL_MAP_INVALIDATE_RANGE_BIT, > + &dstMap, &dstRowStride); > > - if (dstMap) { > - bytesPerRow = srcRowStride; /* bytes per row of blocks */ > - rows = (height + bh - 1) / bh; /* rows in blocks */ > + if (dstMap) { > + bytesPerRow = srcRowStride; /* bytes per row of blocks */ > + rows = (height + bh - 1) / bh; /* rows in blocks */ > > - /* copy rows of blocks */ > - for (i = 0; i < rows; i++) { > - memcpy(dstMap, src, bytesPerRow); > -
Re: [Mesa-dev] [PATCH 1/2] r600g: rework handling of the constants
On 12/31/2012 10:39 PM, Vincent wrote: Le dimanche 30 décembre 2012 à 10:29 -0500, Tom Stellard a écrit : On Wed, Dec 26, 2012 at 05:38:27PM +0100, Vincent Lejeune wrote: From Vadim Girlin patch --- src/gallium/drivers/r600/r600_llvm.c | 27 +++ src/gallium/drivers/r600/r600_shader.c | 39 -- .../drivers/radeon/radeon_setup_tgsi_llvm.c| 4 +++ 3 files changed, 54 insertions(+), 16 deletions(-) diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c index 79f6cf0..cae2131 100644 --- a/src/gallium/drivers/r600/r600_llvm.c +++ b/src/gallium/drivers/r600/r600_llvm.c @@ -25,12 +25,19 @@ static LLVMValueRef llvm_fetch_const( enum tgsi_opcode_type type, unsigned swizzle) { - LLVMValueRef idx = lp_build_const_int32(bld_base->base.gallivm, - radeon_llvm_reg_index_soa(reg->Register.Index, swizzle)); - LLVMValueRef cval = build_intrinsic(bld_base->base.gallivm->builder, - "llvm.AMDGPU.load.const", bld_base->base.elem_type, - &idx, 1, LLVMReadNoneAttribute); - + LLVMValueRef offset[2] = { + LLVMConstInt(LLVMInt64TypeInContext(bld_base->base.gallivm->context), 0, false), + lp_build_const_int32(bld_base->base.gallivm, reg->Register.Index) + }; + if (reg->Register.Indirect) { + struct lp_build_tgsi_soa_context *bld = lp_soa_context(bld_base); + LLVMValueRef index = LLVMBuildLoad(bld_base->base.gallivm->builder, bld->addr[reg->Indirect.Index][reg->Indirect.SwizzleX], ""); + offset[1] = LLVMBuildAdd(bld_base->base.gallivm->builder, offset[1], index, ""); + } + LLVMValueRef const_ptr = LLVMGetFirstGlobal(bld_base->base.gallivm->module); + LLVMValueRef ptr = LLVMBuildGEP(bld_base->base.gallivm->builder, const_ptr, offset, 2, ""); + LLVMValueRef cvecval = LLVMBuildLoad(bld_base->base.gallivm->builder, ptr, ""); + LLVMValueRef cval = LLVMBuildExtractElement(bld_base->base.gallivm->builder, cvecval, lp_build_const_int32(bld_base->base.gallivm, swizzle), ""); return bitcast(bld_base, type, cval); } I thought it would be possible to implement this without using global addresses by passing the offset as a pointer to the backend and letting the backend figure out how to translate it into a kcache address. Can you explain why we are using global variables here? -Tom The main drawback from the offset as a pointer solution is that it does not allow to handle multiple const buffers read. R600g already needs to fetch value from non-default const buffer for clip vertex ; it currently appends some alus to llvm backend output but this part would better fit inside the backend IMHO. Can't you simply encode buffer index as a part of the pointer, e.g. pointer = buffer_index << offset + const_index, similar to the load_const operand? I use global variable because it allows to name pointers and thus to associate a const buffer id with a name (actually "const0" stands for the default const buffer, "const1" is for the second const buffer, and so on). I don't really use the fact it is a global variable inside the backend, in fact any named pointer marked as external could fit (iirc the "external symbol" llvm value could be used too ). Global variables purpose is to model address (function and/or variables) whose value is know at compile time, whereas ExternalSymbol is for address whose value is only know at link time. Vincent @@ -449,6 +456,14 @@ LLVMModuleRef r600_tgsi_llvm( bld_base->op_actions[TGSI_OPCODE_TXP].emit = llvm_emit_tex; bld_base->op_actions[TGSI_OPCODE_CMP].emit = emit_cndlt; + // Generate const buffer pointers + for (unsigned i = 0; i < 16; i++) { + char name[8]; + sprintf(name, "const%d", i); + LLVMTypeRef type = LLVMArrayType(LLVMVectorType(bld_base->base.elem_type, 4), 1024); + LLVMAddGlobalInAddressSpace(bld_base->base.gallivm->module, type, name, 2); + } + lp_build_tgsi_llvm(bld_base, tokens); radeon_llvm_finalize_module(ctx); diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index ac28d22..f8eadd3 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -299,15 +299,21 @@ static unsigned r600_src_from_byte_stream(unsigned char * bytes, static unsigned r600_alu_from_byte_stream(struct r600_shader_ctx *ctx, unsigned char * bytes, unsigned bytes_read) { - unsigned src_idx; + unsigned src_idx, src_num; struct r600_bytecode_alu alu; - unsigned src_const_reg[3]; + unsigned src_use_sel[3]; + unsigned src_sel[3] = {}; uint32_t word0, word1; - + + src_num = bytes[bytes_read++]; + memset(&alu, 0
Re: [Mesa-dev] [PATCH] r600g: rework check_and_set_bank_swizzle
On 12/31/2012 05:34 AM, Vadim Girlin wrote: Optimize it for better performance. Signed-off-by: Vadim Girlin --- I did some benchmarking for this patch together with the patch that introduces ISA tables, using the texCombine test (IIRC it builds hundreds of shaders) and making the driver build each shader 5000 times, total time of the test was reduced from 45 to 25 seconds, the time spent in check_and_set_bank_swizzle is about 8 times less according to the oprofile, the time of r600_shader_from_tgsi is reduced by half. You can also find the patch in this branch: http://cgit.freedesktop.org/~vadimg/mesa/log/?h=r600-disasm After some other benchmarks I think that texCombine benchmark that I used is close to the worst possible case (when most of the inst groups do not use default swizzles, so we have to perform a lot of iterations to find the correct swizzles). Now with other tests I see that in some cases (where most of the alu groups just use default swizzles) this patch might even have slightly worse performance due to additional overhead. I'm going to improve the handling of the default case and gather some stats over the popular apps, and then update the patch to make it more efficient in every case. Vadim ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH] configure.ac: Remove space after indent -T flag.
Fixes this build error on platforms not using GNU indent. indent: Command line: ``-T'' requires a parameter Signed-off-by: Vinson Lee --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1294740..87bb71f 100644 --- a/configure.ac +++ b/configure.ac @@ -73,7 +73,7 @@ AC_PATH_PROG([PERL], [perl]) AC_CHECK_PROG(INDENT, indent, indent, cat) if test "x$INDENT" != "xcat"; then -AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte -T Bool') +AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte -TBool') fi dnl Our fallback install-sh is a symlink to minstall. Use the existing -- 1.8.0 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH] configure.ac: Remove space after indent -T flag.
On Mon, Dec 31, 2012 at 3:27 PM, Vinson Lee wrote: > Fixes this build error on platforms not using GNU indent. > > indent: Command line: ``-T'' requires a parameter > > Signed-off-by: Vinson Lee > --- > configure.ac | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/configure.ac b/configure.ac > index 1294740..87bb71f 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -73,7 +73,7 @@ AC_PATH_PROG([PERL], [perl]) > > AC_CHECK_PROG(INDENT, indent, indent, cat) > if test "x$INDENT" != "xcat"; then > -AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -T GLubyte -T GLbyte > -T Bool') > +AC_SUBST(INDENT_FLAGS, '-i4 -nut -br -brs -npcs -ce -TGLubyte -TGLbyte > -TBool') > fi > > dnl Our fallback install-sh is a symlink to minstall. Use the existing > -- > 1.8.0 Fine by me. I've seen a report that -brs is a GNU-only option and doesn't work with BSD indent. What indent are you using that doesn't accept the space after -T but does accept -brs? https://bugs.gentoo.org/show_bug.cgi?id=428112 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 1/3] mesa: Mark _mesa_{init, delete}_sampler_object as static
--- src/mesa/main/samplerobj.c |4 ++-- src/mesa/main/samplerobj.h |7 --- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 3c3bfff..9b21216 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -110,7 +110,7 @@ _mesa_reference_sampler_object_(struct gl_context *ctx, /** * Initialize the fields of the given sampler object. */ -void +static void _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name) { sampObj->Name = name; @@ -151,7 +151,7 @@ _mesa_new_sampler_object(struct gl_context *ctx, GLuint name) /** * Fallback for ctx->Driver.DeleteSamplerObject(); */ -void +static void _mesa_delete_sampler_object(struct gl_context *ctx, struct gl_sampler_object *sampObj) { diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h index ecff032..dce7c6c 100644 --- a/src/mesa/main/samplerobj.h +++ b/src/mesa/main/samplerobj.h @@ -63,17 +63,10 @@ _mesa_reference_sampler_object(struct gl_context *ctx, } -extern void -_mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name); - extern struct gl_sampler_object * _mesa_new_sampler_object(struct gl_context *ctx, GLuint name); extern void -_mesa_delete_sampler_object(struct gl_context *ctx, -struct gl_sampler_object *sampObj); - -extern void _mesa_init_sampler_object_functions(struct dd_function_table *driver); extern void -- 1.7.8.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] mesa: Add missing ASSERT_OUTSIDE_BEGIN_END to GetSamplerParameter*
--- src/mesa/main/samplerobj.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 1d441bc..773bebf 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -1135,6 +1135,8 @@ _mesa_GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params) struct gl_sampler_object *sampObj; GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameteriv(sampler %u)", @@ -1213,6 +1215,8 @@ _mesa_GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params) struct gl_sampler_object *sampObj; GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glGetSamplerParameterfv(sampler %u)", @@ -1291,6 +1295,8 @@ _mesa_GetSamplerParameterIiv(GLuint sampler, GLenum pname, GLint *params) struct gl_sampler_object *sampObj; GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, @@ -1370,6 +1376,8 @@ _mesa_GetSamplerParameterIuiv(GLuint sampler, GLenum pname, GLuint *params) struct gl_sampler_object *sampObj; GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, -- 1.7.8.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 2/3] mesa: Add missing ASSERT_OUTSIDE_BEGIN_END to SamplerParameter*
Commit f22d49de added the SamplerParamter* functions but only used ASSERT_OUTSIDE_BEGIN_END inside the -f and -fv versions. --- src/mesa/main/samplerobj.c |8 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 9b21216..1d441bc 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -606,6 +606,8 @@ _mesa_SamplerParameteri(GLuint sampler, GLenum pname, GLint param) GLuint res; GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteri(sampler %u)", @@ -777,6 +779,8 @@ _mesa_SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *params) GLuint res; GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameteriv(sampler %u)", @@ -956,6 +960,8 @@ _mesa_SamplerParameterIiv(GLuint sampler, GLenum pname, const GLint *params) GLuint res; GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIiv(sampler %u)", @@ -1042,6 +1048,8 @@ _mesa_SamplerParameterIuiv(GLuint sampler, GLenum pname, const GLuint *params) GLuint res; GET_CURRENT_CONTEXT(ctx); + ASSERT_OUTSIDE_BEGIN_END(ctx); + sampObj = _mesa_lookup_samplerobj(ctx, sampler); if (!sampObj) { _mesa_error(ctx, GL_INVALID_VALUE, "glSamplerParameterIuiv(sampler %u)", -- 1.7.8.6 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
Re: [Mesa-dev] [PATCH 1/3] mesa: Mark _mesa_{init, delete}_sampler_object as static
On 12/31/2012 08:35 PM, Matt Turner wrote: --- src/mesa/main/samplerobj.c |4 ++-- src/mesa/main/samplerobj.h |7 --- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c index 3c3bfff..9b21216 100644 --- a/src/mesa/main/samplerobj.c +++ b/src/mesa/main/samplerobj.c @@ -110,7 +110,7 @@ _mesa_reference_sampler_object_(struct gl_context *ctx, /** * Initialize the fields of the given sampler object. */ -void +static void _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name) { sampObj->Name = name; @@ -151,7 +151,7 @@ _mesa_new_sampler_object(struct gl_context *ctx, GLuint name) /** * Fallback for ctx->Driver.DeleteSamplerObject(); */ -void +static void _mesa_delete_sampler_object(struct gl_context *ctx, struct gl_sampler_object *sampObj) { diff --git a/src/mesa/main/samplerobj.h b/src/mesa/main/samplerobj.h index ecff032..dce7c6c 100644 --- a/src/mesa/main/samplerobj.h +++ b/src/mesa/main/samplerobj.h @@ -63,17 +63,10 @@ _mesa_reference_sampler_object(struct gl_context *ctx, } -extern void -_mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name); - extern struct gl_sampler_object * _mesa_new_sampler_object(struct gl_context *ctx, GLuint name); extern void -_mesa_delete_sampler_object(struct gl_context *ctx, -struct gl_sampler_object *sampObj); - -extern void _mesa_init_sampler_object_functions(struct dd_function_table *driver); extern void This series is: Reviewed-by: Kenneth Graunke ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev