diff options
Diffstat (limited to 'mesalib/src')
23 files changed, 260 insertions, 516 deletions
diff --git a/mesalib/src/gallium/auxiliary/util/u_inlines.h b/mesalib/src/gallium/auxiliary/util/u_inlines.h index 9660cdc6e..c90dc5707 100644 --- a/mesalib/src/gallium/auxiliary/util/u_inlines.h +++ b/mesalib/src/gallium/auxiliary/util/u_inlines.h @@ -461,6 +461,17 @@ static INLINE void util_copy_vertex_buffers(struct pipe_vertex_buffer *dst, memcpy(dst, src, src_count * sizeof(struct pipe_vertex_buffer)); } +static INLINE float +util_get_min_point_size(const struct pipe_rasterizer_state *state) +{ + /* The point size should be clamped to this value at the rasterizer stage. + */ + return state->gl_rasterization_rules && + !state->point_quad_rasterization && + !state->point_smooth && + !state->multisample ? 1.0f : 0.0f; +} + #ifdef __cplusplus } #endif diff --git a/mesalib/src/glsl/Android.mk b/mesalib/src/glsl/Android.mk index d7d17dd6d..754f3cced 100644 --- a/mesalib/src/glsl/Android.mk +++ b/mesalib/src/glsl/Android.mk @@ -34,9 +34,9 @@ include $(LOCAL_PATH)/Makefile.sources include $(CLEAR_VARS) LOCAL_SRC_FILES := \ - $(LIBGLCPP_SOURCES) \ - $(LIBGLSL_SOURCES) \ - $(LIBGLSL_CXX_SOURCES) + $(LIBGLCPP_FILES) \ + $(LIBGLSL_FILES) \ + $(LIBGLSL_CXX_FILES) LOCAL_C_INCLUDES := \ $(MESA_TOP)/src/mapi \ @@ -55,11 +55,11 @@ include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) LOCAL_SRC_FILES := \ - $(LIBGLCPP_SOURCES) \ - $(LIBGLSL_SOURCES) \ - $(LIBGLSL_CXX_SOURCES) \ - $(BUILTIN_COMPILER_CXX_SOURCES) \ - $(GLSL_COMPILER_CXX_SOURCES) + $(LIBGLCPP_FILES) \ + $(LIBGLSL_FILES) \ + $(LIBGLSL_CXX_FILES) \ + $(BUILTIN_COMPILER_CXX_FILES) \ + $(GLSL_COMPILER_CXX_FILES) LOCAL_C_INCLUDES := \ $(MESA_TOP)/src/mapi \ @@ -82,7 +82,7 @@ include $(BUILD_HOST_EXECUTABLE) include $(CLEAR_VARS) LOCAL_SRC_FILES := \ - $(GLSL_COMPILER_CXX_SOURCES) + $(GLSL_COMPILER_CXX_FILES) LOCAL_C_INCLUDES := \ $(MESA_TOP)/src/mapi \ diff --git a/mesalib/src/glsl/Makefile b/mesalib/src/glsl/Makefile index d9ecbc8e3..f6c722997 100644 --- a/mesalib/src/glsl/Makefile +++ b/mesalib/src/glsl/Makefile @@ -10,20 +10,20 @@ LIBNAME = glsl include Makefile.sources GLCPP_SOURCES = \ - $(LIBGLCPP_GENERATED_SOURCES) \ - $(LIBGLCPP_SOURCES) \ + $(LIBGLCPP_GENERATED_FILES) \ + $(LIBGLCPP_FILES) \ ralloc.c \ glcpp/glcpp.c C_SOURCES = \ - $(LIBGLCPP_GENERATED_SOURCES) \ - $(LIBGLCPP_SOURCES) \ - $(LIBGLSL_SOURCES) + $(LIBGLCPP_GENERATED_FILES) \ + $(LIBGLCPP_FILES) \ + $(LIBGLSL_FILES) # common sources for builtin_compiler and libglsl CXX_SOURCES = \ - $(BUILTIN_COMPILER_GENERATED_CXX_SOURCES) \ - $(LIBGLSL_CXX_SOURCES) + $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \ + $(LIBGLSL_CXX_FILES) LIBS = \ $(TOP)/src/glsl/libglsl.a @@ -34,7 +34,7 @@ GLSL2_C_SOURCES = \ ../mesa/program/hash_table.c \ ../mesa/program/symbol_table.c GLSL2_CXX_SOURCES = \ - $(GLSL_COMPILER_CXX_SOURCES) + $(GLSL_COMPILER_CXX_FILES) GLSL2_OBJECTS = \ $(GLSL2_C_SOURCES:.c=.o) \ diff --git a/mesalib/src/glsl/Makefile.sources b/mesalib/src/glsl/Makefile.sources index 5e80af297..06728daf7 100644 --- a/mesalib/src/glsl/Makefile.sources +++ b/mesalib/src/glsl/Makefile.sources @@ -2,20 +2,20 @@ # libglcpp -LIBGLCPP_SOURCES := \ +LIBGLCPP_FILES := \ glcpp/pp.c -LIBGLCPP_GENERATED_SOURCES := \ +LIBGLCPP_GENERATED_FILES := \ glcpp/glcpp-lex.c \ glcpp/glcpp-parse.c # libglsl -LIBGLSL_SOURCES := \ +LIBGLSL_FILES := \ strtod.c \ ralloc.c -LIBGLSL_CXX_SOURCES := \ +LIBGLSL_CXX_FILES := \ ast_expr.cpp \ ast_function.cpp \ ast_to_hir.cpp \ @@ -82,7 +82,7 @@ LIBGLSL_CXX_SOURCES := \ # glsl_compiler -GLSL_COMPILER_CXX_SOURCES := \ +GLSL_COMPILER_CXX_FILES := \ standalone_scaffolding.cpp \ main.cpp @@ -92,14 +92,14 @@ GLSL_COMPILER_CXX_SOURCES := \ # For this to work, a dummy version of builtin_function.cpp, # builtin_stubs.cpp, is used. -BUILTIN_COMPILER_CXX_SOURCES := \ +BUILTIN_COMPILER_CXX_FILES := \ builtin_stubs.cpp -BUILTIN_COMPILER_GENERATED_CXX_SOURCES := \ +BUILTIN_COMPILER_GENERATED_CXX_FILES := \ glsl_lexer.cpp \ glsl_parser.cpp # libglsl generated sources -LIBGLSL_GENERATED_CXX_SOURCES := \ - $(BUILTIN_COMPILER_GENERATED_CXX_SOURCES) \ +LIBGLSL_GENERATED_CXX_FILES := \ + $(BUILTIN_COMPILER_GENERATED_CXX_FILES) \ builtin_function.cpp diff --git a/mesalib/src/glsl/SConscript b/mesalib/src/glsl/SConscript index b8154d608..f8e872368 100644 --- a/mesalib/src/glsl/SConscript +++ b/mesalib/src/glsl/SConscript @@ -42,7 +42,7 @@ glsl_sources = [ source_lists = env.ParseSourceList('Makefile.sources') # add non-generated sources -for l in ('LIBGLCPP_SOURCES', 'LIBGLSL_SOURCES', 'LIBGLSL_CXX_SOURCES'): +for l in ('LIBGLCPP_FILES', 'LIBGLSL_FILES', 'LIBGLSL_CXX_FILES'): glsl_sources += source_lists[l] if env['msvc']: @@ -57,7 +57,7 @@ else: env.Command('hash_table.c', '#src/mesa/program/hash_table.c', Copy('$TARGET', '$SOURCE')) env.Command('symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE')) - compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_SOURCES']) + compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES']) mesa_objs = env.StaticObject([ 'hash_table.c', @@ -69,7 +69,7 @@ else: builtin_compiler = env.Program( target = 'builtin_compiler', source = compiler_objs + glsl_sources + \ - source_lists['BUILTIN_COMPILER_CXX_SOURCES'], + source_lists['BUILTIN_COMPILER_CXX_FILES'], ) # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll diff --git a/mesalib/src/glsl/glsl_parser_extras.cpp b/mesalib/src/glsl/glsl_parser_extras.cpp index 0b53232e9..7f8d47ce9 100644 --- a/mesalib/src/glsl/glsl_parser_extras.cpp +++ b/mesalib/src/glsl/glsl_parser_extras.cpp @@ -114,6 +114,9 @@ _mesa_glsl_parse_state::_mesa_glsl_parse_state(struct gl_context *ctx, } this->supported_version_string = supported; + + if (ctx->Const.ForceGLSLExtensionsWarn) + _mesa_glsl_process_extension("all", NULL, "warn", NULL, this); } const char * diff --git a/mesalib/src/glsl/ir_variable_refcount.cpp b/mesalib/src/glsl/ir_variable_refcount.cpp index 7d39abb36..1633a7357 100644 --- a/mesalib/src/glsl/ir_variable_refcount.cpp +++ b/mesalib/src/glsl/ir_variable_refcount.cpp @@ -36,7 +36,7 @@ // constructor -variable_entry::variable_entry(ir_variable *var) +ir_variable_refcount_entry::ir_variable_refcount_entry(ir_variable *var) { this->var = var; assign = NULL; @@ -46,17 +46,17 @@ variable_entry::variable_entry(ir_variable *var) } -variable_entry * +ir_variable_refcount_entry * ir_variable_refcount_visitor::get_variable_entry(ir_variable *var) { assert(var); foreach_iter(exec_list_iterator, iter, this->variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + ir_variable_refcount_entry *entry = (ir_variable_refcount_entry *)iter.get(); if (entry->var == var) return entry; } - variable_entry *entry = new(mem_ctx) variable_entry(var); + ir_variable_refcount_entry *entry = new(mem_ctx) ir_variable_refcount_entry(var); assert(entry->referenced_count == 0); this->variable_list.push_tail(entry); return entry; @@ -66,7 +66,7 @@ ir_variable_refcount_visitor::get_variable_entry(ir_variable *var) ir_visitor_status ir_variable_refcount_visitor::visit(ir_variable *ir) { - variable_entry *entry = this->get_variable_entry(ir); + ir_variable_refcount_entry *entry = this->get_variable_entry(ir); if (entry) entry->declaration = true; @@ -78,7 +78,7 @@ ir_visitor_status ir_variable_refcount_visitor::visit(ir_dereference_variable *ir) { ir_variable *const var = ir->variable_referenced(); - variable_entry *entry = this->get_variable_entry(var); + ir_variable_refcount_entry *entry = this->get_variable_entry(var); if (entry) entry->referenced_count++; @@ -101,7 +101,7 @@ ir_variable_refcount_visitor::visit_enter(ir_function_signature *ir) ir_visitor_status ir_variable_refcount_visitor::visit_leave(ir_assignment *ir) { - variable_entry *entry; + ir_variable_refcount_entry *entry; entry = this->get_variable_entry(ir->lhs->variable_referenced()); if (entry) { entry->assigned_count++; diff --git a/mesalib/src/glsl/ir_variable_refcount.h b/mesalib/src/glsl/ir_variable_refcount.h index 906135a9e..51a4945a1 100644 --- a/mesalib/src/glsl/ir_variable_refcount.h +++ b/mesalib/src/glsl/ir_variable_refcount.h @@ -33,10 +33,10 @@ #include "ir_visitor.h" #include "glsl_types.h" -class variable_entry : public exec_node +class ir_variable_refcount_entry : public exec_node { public: - variable_entry(ir_variable *var); + ir_variable_refcount_entry(ir_variable *var); ir_variable *var; /* The key: the variable's pointer. */ ir_assignment *assign; /* An assignment to the variable, if any */ @@ -69,9 +69,9 @@ public: virtual ir_visitor_status visit_enter(ir_function_signature *); virtual ir_visitor_status visit_leave(ir_assignment *); - variable_entry *get_variable_entry(ir_variable *var); + ir_variable_refcount_entry *get_variable_entry(ir_variable *var); - /* List of variable_entry */ + /* List of ir_variable_refcount_entry */ exec_list variable_list; void *mem_ctx; diff --git a/mesalib/src/glsl/opt_dead_code.cpp b/mesalib/src/glsl/opt_dead_code.cpp index 5b9546ad4..22c7af1c2 100644 --- a/mesalib/src/glsl/opt_dead_code.cpp +++ b/mesalib/src/glsl/opt_dead_code.cpp @@ -50,7 +50,7 @@ do_dead_code(exec_list *instructions, bool uniform_locations_assigned) v.run(instructions); foreach_iter(exec_list_iterator, iter, v.variable_list) { - variable_entry *entry = (variable_entry *)iter.get(); + ir_variable_refcount_entry *entry = (ir_variable_refcount_entry *)iter.get(); /* Since each assignment is a reference, the refereneced count must be * greater than or equal to the assignment count. If they are equal, diff --git a/mesalib/src/glsl/opt_tree_grafting.cpp b/mesalib/src/glsl/opt_tree_grafting.cpp index d32d14e88..e2aff5f80 100644 --- a/mesalib/src/glsl/opt_tree_grafting.cpp +++ b/mesalib/src/glsl/opt_tree_grafting.cpp @@ -349,7 +349,7 @@ tree_grafting_basic_block(ir_instruction *bb_first, lhs_var->mode == ir_var_inout) continue; - variable_entry *entry = info->refs->get_variable_entry(lhs_var); + ir_variable_refcount_entry *entry = info->refs->get_variable_entry(lhs_var); if (!entry->declaration || entry->assigned_count != 1 || diff --git a/mesalib/src/mesa/drivers/dri/common/Makefile.am b/mesalib/src/mesa/drivers/dri/common/Makefile.am index 4b43f4409..27c3e3d42 100644 --- a/mesalib/src/mesa/drivers/dri/common/Makefile.am +++ b/mesalib/src/mesa/drivers/dri/common/Makefile.am @@ -35,3 +35,5 @@ libdricommon_la_SOURCES = \ utils.c \ dri_util.c \ xmlconfig.c + +sysconf_DATA = drirc diff --git a/mesalib/src/mesa/drivers/dri/common/drirc b/mesalib/src/mesa/drivers/dri/common/drirc new file mode 100644 index 000000000..7abc64648 --- /dev/null +++ b/mesalib/src/mesa/drivers/dri/common/drirc @@ -0,0 +1,7 @@ +<driconf> + <device screen="0" driver="i965"> + <application name="Sanctuary"> + <option name="force_glsl_extensions_warn" value="true" /> + </application> + </device> +</driconf> diff --git a/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h b/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h index 1e584ba08..75c887e5d 100644 --- a/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h +++ b/mesalib/src/mesa/drivers/dri/common/xmlpool/options.h @@ -626,3 +626,13 @@ DRI_CONF_OPT_BEGIN(always_flush_cache,bool,def) \ DRI_CONF_DESC(fr,"Enable flushing GPU caches with each draw call") \ DRI_CONF_DESC(sv,"Enable flushing GPU caches with each draw call") \ DRI_CONF_OPT_END + +#define DRI_CONF_FORCE_GLSL_EXTENSIONS_WARN(def) \ +DRI_CONF_OPT_BEGIN(force_glsl_extensions_warn,bool,def) \ + DRI_CONF_DESC(en,"Force GLSL extension default behavior to 'warn'") \ + DRI_CONF_DESC(de,"Force GLSL extension default behavior to 'warn'") \ + DRI_CONF_DESC(es,"Force GLSL extension default behavior to 'warn'") \ + DRI_CONF_DESC(nl,"Force GLSL extension default behavior to 'warn'") \ + DRI_CONF_DESC(fr,"Force GLSL extension default behavior to 'warn'") \ + DRI_CONF_DESC(sv,"Force GLSL extension default behavior to 'warn'") \ +DRI_CONF_OPT_END diff --git a/mesalib/src/mesa/main/format_pack.c b/mesalib/src/mesa/main/format_pack.c index 85b2c691c..ea1d95ee9 100644 --- a/mesalib/src/mesa/main/format_pack.c +++ b/mesalib/src/mesa/main/format_pack.c @@ -2050,6 +2050,48 @@ _mesa_pack_ubyte_rgba_row(gl_format format, GLuint n, /** + * Pack a 2D image of ubyte RGBA pixels in the given format. + * \param srcRowStride source image row stride in bytes + * \param dstRowStride destination image row stride in bytes + */ +void +_mesa_pack_ubyte_rgba_rect(gl_format format, GLuint width, GLuint height, + const GLubyte *src, GLint srcRowStride, + void *dst, GLint dstRowStride) +{ + pack_ubyte_rgba_row_func packrow = get_pack_ubyte_rgba_row_function(format); + GLubyte *dstUB = (GLubyte *) dst; + GLuint i; + + if (packrow) { + if (srcRowStride == width * 4 * sizeof(GLubyte) && + dstRowStride == _mesa_format_row_stride(format, width)) { + /* do whole image at once */ + packrow(width * height, (const GLubyte (*)[4]) src, dst); + } + else { + /* row by row */ + for (i = 0; i < height; i++) { + packrow(width, (const GLubyte (*)[4]) src, dstUB); + src += srcRowStride; + dstUB += dstRowStride; + } + } + } + else { + /* slower fallback */ + for (i = 0; i < height; i++) { + _mesa_pack_ubyte_rgba_row(format, width, + (const GLubyte (*)[4]) src, dstUB); + src += srcRowStride; + dstUB += dstRowStride; + } + } +} + + + +/** ** Pack float Z pixels **/ diff --git a/mesalib/src/mesa/main/format_pack.h b/mesalib/src/mesa/main/format_pack.h index f1b480510..20b2ad8a5 100644 --- a/mesalib/src/mesa/main/format_pack.h +++ b/mesalib/src/mesa/main/format_pack.h @@ -77,6 +77,10 @@ _mesa_pack_ubyte_rgba_row(gl_format format, GLuint n, const GLubyte src[][4], void *dst); +extern void +_mesa_pack_ubyte_rgba_rect(gl_format format, GLuint width, GLuint height, + const GLubyte *src, GLint srcRowStride, + void *dst, GLint dstRowStride); extern void _mesa_pack_float_z_row(gl_format format, GLuint n, diff --git a/mesalib/src/mesa/main/format_unpack.c b/mesalib/src/mesa/main/format_unpack.c index a2d889116..cd16a9ea6 100644 --- a/mesalib/src/mesa/main/format_unpack.c +++ b/mesalib/src/mesa/main/format_unpack.c @@ -2393,6 +2393,51 @@ unpack_int_rgba_LUMINANCE_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) } static void +unpack_int_rgba_LUMINANCE_UINT16(const GLushort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = dst[i][1] = dst[i][2] = src[i]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_LUMINANCE_INT16(const GLshort *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = dst[i][1] = dst[i][2] = src[i]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_LUMINANCE_UINT8(const GLubyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = dst[i][1] = dst[i][2] = src[i]; + dst[i][3] = 1; + } +} + +static void +unpack_int_rgba_LUMINANCE_INT8(const GLbyte *src, GLuint dst[][4], GLuint n) +{ + unsigned int i; + + for (i = 0; i < n; i++) { + dst[i][0] = dst[i][1] = dst[i][2] = src[i]; + dst[i][3] = 1; + } +} + + +static void unpack_int_rgba_LUMINANCE_ALPHA_UINT32(const GLuint *src, GLuint dst[][4], GLuint n) { unsigned int i; @@ -2618,6 +2663,19 @@ _mesa_unpack_uint_rgba_row(gl_format format, GLuint n, case MESA_FORMAT_LUMINANCE_INT32: unpack_int_rgba_LUMINANCE_UINT32(src, dst, n); break; + case MESA_FORMAT_LUMINANCE_UINT16: + unpack_int_rgba_LUMINANCE_UINT16(src, dst, n); + break; + case MESA_FORMAT_LUMINANCE_INT16: + unpack_int_rgba_LUMINANCE_INT16(src, dst, n); + break; + + case MESA_FORMAT_LUMINANCE_UINT8: + unpack_int_rgba_LUMINANCE_UINT8(src, dst, n); + break; + case MESA_FORMAT_LUMINANCE_INT8: + unpack_int_rgba_LUMINANCE_INT8(src, dst, n); + break; case MESA_FORMAT_LUMINANCE_ALPHA_UINT32: case MESA_FORMAT_LUMINANCE_ALPHA_INT32: diff --git a/mesalib/src/mesa/main/mtypes.h b/mesalib/src/mesa/main/mtypes.h index a2b01d05d..99dcb389b 100644 --- a/mesalib/src/mesa/main/mtypes.h +++ b/mesalib/src/mesa/main/mtypes.h @@ -2772,6 +2772,12 @@ struct gl_constants GLuint GLSLVersion; /**< GLSL version supported (ex: 120 = 1.20) */ /** + * Changes default GLSL extension behavior from "error" to "warn". It's out + * of spec, but it can make some apps work that otherwise wouldn't. + */ + GLboolean ForceGLSLExtensionsWarn; + + /** * Does the driver support real 32-bit integers? (Otherwise, integers are * simulated via floats.) */ diff --git a/mesalib/src/mesa/main/texstore.c b/mesalib/src/mesa/main/texstore.c index 827fcb788..8c51a948e 100644 --- a/mesalib/src/mesa/main/texstore.c +++ b/mesalib/src/mesa/main/texstore.c @@ -55,6 +55,7 @@ #include "glheader.h" #include "bufferobj.h" #include "colormac.h" +#include "format_pack.h" #include "image.h" #include "macros.h" #include "mipmap.h" @@ -967,6 +968,41 @@ memcpy_texture(struct gl_context *ctx, } +/** + * General-case function for storing a color texture images with + * components that can be represented with ubytes. Example destination + * texture formats are MESA_FORMAT_ARGB888, ARGB4444, RGB565. + */ +static GLboolean +store_ubyte_texture(TEXSTORE_PARAMS) +{ + const GLint srcRowStride = srcWidth * 4 * sizeof(GLubyte); + GLubyte *tempImage, *src; + GLint img; + + tempImage = _mesa_make_temp_ubyte_image(ctx, dims, + baseInternalFormat, + GL_RGBA, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, + srcPacking); + if (!tempImage) + return GL_FALSE; + + src = tempImage; + for (img = 0; img < srcDepth; img++) { + _mesa_pack_ubyte_rgba_rect(dstFormat, srcWidth, srcHeight, + src, srcRowStride, + dstSlices[img], dstRowStride); + src += srcHeight * srcRowStride; + } + free(tempImage); + + return GL_TRUE; +} + + + /** * Store a 32-bit integer or float depth component texture image. @@ -1132,8 +1168,6 @@ _mesa_texstore_z16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb565(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_RGB565 || dstFormat == MESA_FORMAT_RGB565_REV); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); @@ -1184,42 +1218,10 @@ _mesa_texstore_rgb565(TEXSTORE_PARAMS) } } else { - /* general path */ - const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLubyte *src = tempImage; - GLint img, row, col; - if (!tempImage) - return GL_FALSE; - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[img]; - for (row = 0; row < srcHeight; row++) { - GLushort *dstUS = (GLushort *) dstRow; - /* check for byteswapped format */ - if (dstFormat == MESA_FORMAT_RGB565) { - for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_565( src[RCOMP], - src[GCOMP], - src[BCOMP] ); - src += 3; - } - } - else { - for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_565_REV( src[RCOMP], - src[GCOMP], - src[BCOMP] ); - src += 3; - } - } - dstRow += dstRowStride; - } - } - free((void *) tempImage); + return store_ubyte_texture(ctx, dims, baseInternalFormat, + dstFormat, dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, srcPacking); } return GL_TRUE; } @@ -1232,7 +1234,6 @@ static GLboolean _mesa_texstore_rgba8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); ASSERT(dstFormat == MESA_FORMAT_RGBA8888 || dstFormat == MESA_FORMAT_RGBA8888_REV || @@ -1288,44 +1289,10 @@ _mesa_texstore_rgba8888(TEXSTORE_PARAMS) srcPacking); } else { - /* general path */ - const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLubyte *src = tempImage; - GLint img, row, col; - if (!tempImage) - return GL_FALSE; - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[img]; - for (row = 0; row < srcHeight; row++) { - GLuint *dstUI = (GLuint *) dstRow; - if (dstFormat == MESA_FORMAT_RGBA8888 || - dstFormat == MESA_FORMAT_RGBX8888) { - for (col = 0; col < srcWidth; col++) { - dstUI[col] = PACK_COLOR_8888( src[RCOMP], - src[GCOMP], - src[BCOMP], - src[ACOMP] ); - src += 4; - } - } - else { - for (col = 0; col < srcWidth; col++) { - dstUI[col] = PACK_COLOR_8888_REV( src[RCOMP], - src[GCOMP], - src[BCOMP], - src[ACOMP] ); - src += 4; - } - } - dstRow += dstRowStride; - } - } - free((void *) tempImage); + return store_ubyte_texture(ctx, dims, baseInternalFormat, + dstFormat, dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, srcPacking); } return GL_TRUE; } @@ -1335,7 +1302,6 @@ static GLboolean _mesa_texstore_argb8888(TEXSTORE_PARAMS) { const GLboolean littleEndian = _mesa_little_endian(); - const GLenum baseFormat = GL_RGBA; ASSERT(dstFormat == MESA_FORMAT_ARGB8888 || dstFormat == MESA_FORMAT_ARGB8888_REV || @@ -1457,52 +1423,10 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) srcPacking); } else { - /* general path */ - const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLubyte *src = tempImage; - GLint img, row, col; - if (!tempImage) - return GL_FALSE; - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[img]; - for (row = 0; row < srcHeight; row++) { - GLuint *dstUI = (GLuint *) dstRow; - if (dstFormat == MESA_FORMAT_ARGB8888) { - for (col = 0; col < srcWidth; col++) { - dstUI[col] = PACK_COLOR_8888( src[ACOMP], - src[RCOMP], - src[GCOMP], - src[BCOMP] ); - src += 4; - } - } - else if (dstFormat == MESA_FORMAT_XRGB8888) { - for (col = 0; col < srcWidth; col++) { - dstUI[col] = PACK_COLOR_8888( 0xff, - src[RCOMP], - src[GCOMP], - src[BCOMP] ); - src += 4; - } - } - else { - for (col = 0; col < srcWidth; col++) { - dstUI[col] = PACK_COLOR_8888_REV( src[ACOMP], - src[RCOMP], - src[GCOMP], - src[BCOMP] ); - src += 4; - } - } - dstRow += dstRowStride; - } - } - free((void *) tempImage); + return store_ubyte_texture(ctx, dims, baseInternalFormat, + dstFormat, dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, srcPacking); } return GL_TRUE; } @@ -1511,8 +1435,6 @@ _mesa_texstore_argb8888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb888(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_RGB888); ASSERT(_mesa_get_format_bytes(dstFormat) == 3); @@ -1574,49 +1496,10 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) srcPacking); } else { - /* general path */ - const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLubyte *src = (const GLubyte *) tempImage; - GLint img, row, col; - if (!tempImage) - return GL_FALSE; - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[img]; - for (row = 0; row < srcHeight; row++) { -#if 0 - if (littleEndian) { - for (col = 0; col < srcWidth; col++) { - dstRow[col * 3 + 0] = src[RCOMP]; - dstRow[col * 3 + 1] = src[GCOMP]; - dstRow[col * 3 + 2] = src[BCOMP]; - srcUB += 3; - } - } - else { - for (col = 0; col < srcWidth; col++) { - dstRow[col * 3 + 0] = srcUB[BCOMP]; - dstRow[col * 3 + 1] = srcUB[GCOMP]; - dstRow[col * 3 + 2] = srcUB[RCOMP]; - srcUB += 3; - } - } -#else - for (col = 0; col < srcWidth; col++) { - dstRow[col * 3 + 0] = src[BCOMP]; - dstRow[col * 3 + 1] = src[GCOMP]; - dstRow[col * 3 + 2] = src[RCOMP]; - src += 3; - } -#endif - dstRow += dstRowStride; - } - } - free((void *) tempImage); + return store_ubyte_texture(ctx, dims, baseInternalFormat, + dstFormat, dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, srcPacking); } return GL_TRUE; } @@ -1625,8 +1508,6 @@ _mesa_texstore_rgb888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_bgr888(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_BGR888); ASSERT(_mesa_get_format_bytes(dstFormat) == 3); @@ -1688,30 +1569,10 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) srcPacking); } else { - /* general path */ - const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLubyte *src = (const GLubyte *) tempImage; - GLint img, row, col; - if (!tempImage) - return GL_FALSE; - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[img]; - for (row = 0; row < srcHeight; row++) { - for (col = 0; col < srcWidth; col++) { - dstRow[col * 3 + 0] = src[RCOMP]; - dstRow[col * 3 + 1] = src[GCOMP]; - dstRow[col * 3 + 2] = src[BCOMP]; - src += 3; - } - dstRow += dstRowStride; - } - } - free((void *) tempImage); + return store_ubyte_texture(ctx, dims, baseInternalFormat, + dstFormat, dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, srcPacking); } return GL_TRUE; } @@ -1720,8 +1581,6 @@ _mesa_texstore_bgr888(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb4444(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_ARGB4444 || dstFormat == MESA_FORMAT_ARGB4444_REV); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); @@ -1738,43 +1597,10 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) srcAddr, srcPacking); } else { - /* general path */ - const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLubyte *src = tempImage; - GLint img, row, col; - if (!tempImage) - return GL_FALSE; - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[img]; - for (row = 0; row < srcHeight; row++) { - GLushort *dstUS = (GLushort *) dstRow; - if (dstFormat == MESA_FORMAT_ARGB4444) { - for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_4444( src[ACOMP], - src[RCOMP], - src[GCOMP], - src[BCOMP] ); - src += 4; - } - } - else { - for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_4444_REV( src[ACOMP], - src[RCOMP], - src[GCOMP], - src[BCOMP] ); - src += 4; - } - } - dstRow += dstRowStride; - } - } - free((void *) tempImage); + return store_ubyte_texture(ctx, dims, baseInternalFormat, + dstFormat, dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, srcPacking); } return GL_TRUE; } @@ -1782,8 +1608,6 @@ _mesa_texstore_argb4444(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgba5551(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_RGBA5551); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); @@ -1799,32 +1623,10 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) srcAddr, srcPacking); } else { - /* general path */ - const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLubyte *src =tempImage; - GLint img, row, col; - if (!tempImage) - return GL_FALSE; - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[img]; - for (row = 0; row < srcHeight; row++) { - GLushort *dstUS = (GLushort *) dstRow; - for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_5551( src[RCOMP], - src[GCOMP], - src[BCOMP], - src[ACOMP] ); - src += 4; - } - dstRow += dstRowStride; - } - } - free((void *) tempImage); + return store_ubyte_texture(ctx, dims, baseInternalFormat, + dstFormat, dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, srcPacking); } return GL_TRUE; } @@ -1832,8 +1634,6 @@ _mesa_texstore_rgba5551(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_argb1555(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_ARGB1555 || dstFormat == MESA_FORMAT_ARGB1555_REV); ASSERT(_mesa_get_format_bytes(dstFormat) == 2); @@ -1850,43 +1650,10 @@ _mesa_texstore_argb1555(TEXSTORE_PARAMS) srcAddr, srcPacking); } else { - /* general path */ - const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLubyte *src =tempImage; - GLint img, row, col; - if (!tempImage) - return GL_FALSE; - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[img]; - for (row = 0; row < srcHeight; row++) { - GLushort *dstUS = (GLushort *) dstRow; - if (dstFormat == MESA_FORMAT_ARGB1555) { - for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_1555( src[ACOMP], - src[RCOMP], - src[GCOMP], - src[BCOMP] ); - src += 4; - } - } - else { - for (col = 0; col < srcWidth; col++) { - dstUS[col] = PACK_COLOR_1555_REV( src[ACOMP], - src[RCOMP], - src[GCOMP], - src[BCOMP] ); - src += 4; - } - } - dstRow += dstRowStride; - } - } - free((void *) tempImage); + return store_ubyte_texture(ctx, dims, baseInternalFormat, + dstFormat, dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, srcPacking); } return GL_TRUE; } @@ -2396,8 +2163,6 @@ _mesa_texstore_signed_rgba_16(TEXSTORE_PARAMS) static GLboolean _mesa_texstore_rgb332(TEXSTORE_PARAMS) { - const GLenum baseFormat = _mesa_get_format_base_format(dstFormat); - ASSERT(dstFormat == MESA_FORMAT_RGB332); ASSERT(_mesa_get_format_bytes(dstFormat) == 1); @@ -2413,30 +2178,10 @@ _mesa_texstore_rgb332(TEXSTORE_PARAMS) srcAddr, srcPacking); } else { - /* general path */ - const GLubyte *tempImage = _mesa_make_temp_ubyte_image(ctx, dims, - baseInternalFormat, - baseFormat, - srcWidth, srcHeight, srcDepth, - srcFormat, srcType, srcAddr, - srcPacking); - const GLubyte *src = tempImage; - GLint img, row, col; - if (!tempImage) - return GL_FALSE; - for (img = 0; img < srcDepth; img++) { - GLubyte *dstRow = dstSlices[img]; - for (row = 0; row < srcHeight; row++) { - for (col = 0; col < srcWidth; col++) { - dstRow[col] = PACK_COLOR_332( src[RCOMP], - src[GCOMP], - src[BCOMP] ); - src += 3; - } - dstRow += dstRowStride; - } - } - free((void *) tempImage); + return store_ubyte_texture(ctx, dims, baseInternalFormat, + dstFormat, dstRowStride, dstSlices, + srcWidth, srcHeight, srcDepth, + srcFormat, srcType, srcAddr, srcPacking); } return GL_TRUE; } diff --git a/mesalib/src/mesa/program/prog_statevars.c b/mesalib/src/mesa/program/prog_statevars.c index f34a6d360..98ab9d003 100644 --- a/mesalib/src/mesa/program/prog_statevars.c +++ b/mesalib/src/mesa/program/prog_statevars.c @@ -495,29 +495,6 @@ _mesa_fetch_state(struct gl_context *ctx, const gl_state_index state[], value[3] = ctx->Point.Threshold; } return; - case STATE_POINT_SIZE_IMPL_CLAMP: - { - /* for implementation clamp only in vs */ - GLfloat minImplSize; - GLfloat maxImplSize; - if (ctx->Point.PointSprite) { - minImplSize = ctx->Const.MinPointSizeAA; - maxImplSize = ctx->Const.MaxPointSize; - } - else if (ctx->Point.SmoothFlag || ctx->Multisample._Enabled) { - minImplSize = ctx->Const.MinPointSizeAA; - maxImplSize = ctx->Const.MaxPointSizeAA; - } - else { - minImplSize = ctx->Const.MinPointSize; - maxImplSize = ctx->Const.MaxPointSize; - } - value[0] = ctx->Point.Size; - value[1] = minImplSize; - value[2] = maxImplSize; - value[3] = ctx->Point.Threshold; - } - return; case STATE_LIGHT_SPOT_DIR_NORMALIZED: { /* here, state[2] is the light number */ @@ -729,7 +706,6 @@ _mesa_program_state_flags(const gl_state_index state[STATE_LENGTH]) case STATE_FOG_PARAMS_OPTIMIZED: return _NEW_FOG; case STATE_POINT_SIZE_CLAMPED: - case STATE_POINT_SIZE_IMPL_CLAMP: return _NEW_POINT | _NEW_MULTISAMPLE; case STATE_LIGHT_SPOT_DIR_NORMALIZED: case STATE_LIGHT_POSITION: @@ -921,9 +897,6 @@ append_token(char *dst, gl_state_index k) case STATE_POINT_SIZE_CLAMPED: append(dst, "pointSizeClamped"); break; - case STATE_POINT_SIZE_IMPL_CLAMP: - append(dst, "pointSizeImplClamp"); - break; case STATE_LIGHT_SPOT_DIR_NORMALIZED: append(dst, "lightSpotDirNormalized"); break; diff --git a/mesalib/src/mesa/program/prog_statevars.h b/mesalib/src/mesa/program/prog_statevars.h index 8b731e12b..65baa7833 100644 --- a/mesalib/src/mesa/program/prog_statevars.h +++ b/mesalib/src/mesa/program/prog_statevars.h @@ -118,7 +118,6 @@ typedef enum gl_state_index_ { STATE_TEXRECT_SCALE, STATE_FOG_PARAMS_OPTIMIZED, /* for faster fog calc */ STATE_POINT_SIZE_CLAMPED, /* includes implementation dependent size clamp */ - STATE_POINT_SIZE_IMPL_CLAMP, /* for implementation clamp only in vs */ STATE_LIGHT_SPOT_DIR_NORMALIZED, /* pre-normalized spot dir */ STATE_LIGHT_POSITION, /* object vs eye space */ STATE_LIGHT_POSITION_NORMALIZED, /* object vs eye space */ diff --git a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c index 25799bf2b..204f505a6 100644 --- a/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c +++ b/mesalib/src/mesa/state_tracker/st_atom_rasterizer.c @@ -90,28 +90,10 @@ static void update_raster_state( struct st_context *st ) if (ctx->Light.ProvokingVertex == GL_FIRST_VERTEX_CONVENTION_EXT) raster->flatshade_first = 1; - /* _NEW_LIGHT | _NEW_PROGRAM - * - * Back-face colors can come from traditional lighting (when - * GL_LIGHT_MODEL_TWO_SIDE is set) or from vertex programs/shaders (when - * GL_VERTEX_PROGRAM_TWO_SIDE is set). Note the logic here. - */ - if (ctx->VertexProgram._Current) { - if (ctx->VertexProgram._Enabled || - (ctx->Shader.CurrentVertexProgram && - ctx->Shader.CurrentVertexProgram->LinkStatus)) { - /* user-defined vertex program or shader */ - raster->light_twoside = ctx->VertexProgram.TwoSideEnabled; - } - else { - /* TNL-generated program */ - raster->light_twoside = ctx->Light.Enabled && ctx->Light.Model.TwoSide; - } - } - else if (ctx->Light.Enabled && ctx->Light.Model.TwoSide) { - raster->light_twoside = 1; - } + /* _NEW_LIGHT | _NEW_PROGRAM */ + raster->light_twoside = ctx->VertexProgram._TwoSideEnabled; + /*_NEW_LIGHT | _NEW_BUFFERS */ raster->clamp_vertex_color = !st->clamp_vert_color_in_shader && ctx->Light._ClampVertexColor; diff --git a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index ab05896ce..f139e95fe 100644 --- a/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/mesalib/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -3843,12 +3843,6 @@ struct st_translate { struct ureg_src samplers[PIPE_MAX_SAMPLERS]; struct ureg_src systemValues[SYSTEM_VALUE_MAX]; - /* Extra info for handling point size clamping in vertex shader */ - struct ureg_dst pointSizeResult; /**< Actual point size output register */ - struct ureg_src pointSizeConst; /**< Point size range constant register */ - GLint pointSizeOutIndex; /**< Temp point size output register */ - GLboolean prevInstWrotePointSize; - const GLuint *inputMapping; const GLuint *outputMapping; @@ -3970,9 +3964,6 @@ dst_register(struct st_translate *t, return t->temps[index]; case PROGRAM_OUTPUT: - if (t->procType == TGSI_PROCESSOR_VERTEX && index == VERT_RESULT_PSIZ) - t->prevInstWrotePointSize = GL_TRUE; - if (t->procType == TGSI_PROCESSOR_VERTEX) assert(index < VERT_RESULT_MAX); else if (t->procType == TGSI_PROCESSOR_FRAGMENT) @@ -4502,8 +4493,6 @@ st_translate_program( t->inputMapping = inputMapping; t->outputMapping = outputMapping; t->ureg = ureg; - t->pointSizeOutIndex = -1; - t->prevInstWrotePointSize = GL_FALSE; if (program->shader_program) { for (i = 0; i < program->shader_program->NumUserUniformStorage; i++) { @@ -4597,25 +4586,6 @@ st_translate_program( outputSemanticName[i], outputSemanticIndex[i]); } - if ((outputSemanticName[i] == TGSI_SEMANTIC_PSIZE) && proginfo->Id) { - /* Writing to the point size result register requires special - * handling to implement clamping. - */ - static const gl_state_index pointSizeClampState[STATE_LENGTH] - = { STATE_INTERNAL, STATE_POINT_SIZE_IMPL_CLAMP, (gl_state_index)0, (gl_state_index)0, (gl_state_index)0 }; - /* XXX: note we are modifying the incoming shader here! Need to - * do this before emitting the constant decls below, or this - * will be missed. - */ - unsigned pointSizeClampConst = - _mesa_add_state_reference(proginfo->Parameters, - pointSizeClampState); - struct ureg_dst psizregtemp = ureg_DECL_temporary(ureg); - t->pointSizeConst = ureg_DECL_constant(ureg, pointSizeClampConst); - t->pointSizeResult = t->outputs[i]; - t->pointSizeOutIndex = i; - t->outputs[i] = psizregtemp; - } } if (passthrough_edgeflags) emit_edgeflags(t); @@ -4723,25 +4693,6 @@ st_translate_program( set_insn_start(t, ureg_get_instruction_number(ureg)); compile_tgsi_instruction(t, (glsl_to_tgsi_instruction *)iter.get(), clamp_color); - - if (t->prevInstWrotePointSize && proginfo->Id) { - /* The previous instruction wrote to the (fake) vertex point size - * result register. Now we need to clamp that value to the min/max - * point size range, putting the result into the real point size - * register. - * Note that we can't do this easily at the end of program due to - * possible early return. - */ - set_insn_start(t, ureg_get_instruction_number(ureg)); - ureg_MAX(t->ureg, - ureg_writemask(t->outputs[t->pointSizeOutIndex], WRITEMASK_X), - ureg_src(t->outputs[t->pointSizeOutIndex]), - ureg_swizzle(t->pointSizeConst, 1,1,1,1)); - ureg_MIN(t->ureg, ureg_writemask(t->pointSizeResult, WRITEMASK_X), - ureg_src(t->outputs[t->pointSizeOutIndex]), - ureg_swizzle(t->pointSizeConst, 2,2,2,2)); - } - t->prevInstWrotePointSize = GL_FALSE; } /* Fix up all emitted labels: diff --git a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c index fc77089e7..e414ed88c 100644 --- a/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c +++ b/mesalib/src/mesa/state_tracker/st_mesa_to_tgsi.c @@ -74,12 +74,6 @@ struct st_translate { struct ureg_src samplers[PIPE_MAX_SAMPLERS]; struct ureg_src systemValues[SYSTEM_VALUE_MAX]; - /* Extra info for handling point size clamping in vertex shader */ - struct ureg_dst pointSizeResult; /**< Actual point size output register */ - struct ureg_src pointSizeConst; /**< Point size range constant register */ - GLint pointSizeOutIndex; /**< Temp point size output register */ - GLboolean prevInstWrotePointSize; - const GLuint *inputMapping; const GLuint *outputMapping; @@ -187,9 +181,6 @@ dst_register( struct st_translate *t, return t->temps[index]; case PROGRAM_OUTPUT: - if (t->procType == TGSI_PROCESSOR_VERTEX && index == VERT_RESULT_PSIZ) - t->prevInstWrotePointSize = GL_TRUE; - if (t->procType == TGSI_PROCESSOR_VERTEX) assert(index < VERT_RESULT_MAX); else if (t->procType == TGSI_PROCESSOR_FRAGMENT) @@ -1057,8 +1048,6 @@ st_translate_mesa_program( t->inputMapping = inputMapping; t->outputMapping = outputMapping; t->ureg = ureg; - t->pointSizeOutIndex = -1; - t->prevInstWrotePointSize = GL_FALSE; /*_mesa_print_program(program);*/ @@ -1149,25 +1138,6 @@ st_translate_mesa_program( t->outputs[i] = ureg_DECL_output( ureg, outputSemanticName[i], outputSemanticIndex[i] ); - if ((outputSemanticName[i] == TGSI_SEMANTIC_PSIZE) && program->Id) { - /* Writing to the point size result register requires special - * handling to implement clamping. - */ - static const gl_state_index pointSizeClampState[STATE_LENGTH] - = { STATE_INTERNAL, STATE_POINT_SIZE_IMPL_CLAMP, 0, 0, 0 }; - /* XXX: note we are modifying the incoming shader here! Need to - * do this before emitting the constant decls below, or this - * will be missed: - */ - unsigned pointSizeClampConst = - _mesa_add_state_reference(program->Parameters, - pointSizeClampState); - struct ureg_dst psizregtemp = ureg_DECL_temporary( ureg ); - t->pointSizeConst = ureg_DECL_constant( ureg, pointSizeClampConst ); - t->pointSizeResult = t->outputs[i]; - t->pointSizeOutIndex = i; - t->outputs[i] = psizregtemp; - } } if (passthrough_edgeflags) emit_edgeflags( t, program ); @@ -1259,25 +1229,6 @@ st_translate_mesa_program( for (i = 0; i < program->NumInstructions; i++) { set_insn_start( t, ureg_get_instruction_number( ureg )); compile_instruction( t, &program->Instructions[i], clamp_color ); - - if (t->prevInstWrotePointSize && program->Id) { - /* The previous instruction wrote to the (fake) vertex point size - * result register. Now we need to clamp that value to the min/max - * point size range, putting the result into the real point size - * register. - * Note that we can't do this easily at the end of program due to - * possible early return. - */ - set_insn_start( t, ureg_get_instruction_number( ureg )); - ureg_MAX( t->ureg, - ureg_writemask(t->outputs[t->pointSizeOutIndex], WRITEMASK_X), - ureg_src(t->outputs[t->pointSizeOutIndex]), - ureg_swizzle(t->pointSizeConst, 1,1,1,1)); - ureg_MIN( t->ureg, ureg_writemask(t->pointSizeResult, WRITEMASK_X), - ureg_src(t->outputs[t->pointSizeOutIndex]), - ureg_swizzle(t->pointSizeConst, 2,2,2,2)); - } - t->prevInstWrotePointSize = GL_FALSE; } /* Fix up all emitted labels: |