diff options
author | Jason Ekstrand <[email protected]> | 2016-04-04 13:58:05 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2016-04-04 13:58:05 -0700 |
commit | 6a049687841d87fc5bbd0fb0a192f03776f67630 (patch) | |
tree | ddb5d24f705b0451b948906df697082b9f47d0a3 /src/mesa | |
parent | fe247bbe922ab862914bc76c10557157a06700ac (diff) | |
parent | 88ef2476dcdd61000cbae7ded9c8fa52927429d8 (diff) |
Merge remote-tracking branch 'public/master' into vulkan
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_compiler.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_compiler.h | 6 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 30 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_surface_formats.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vec4_nir.cpp | 30 | ||||
-rw-r--r-- | src/mesa/main/extensions_table.h | 4 | ||||
-rw-r--r-- | src/mesa/main/get_hash_params.py | 8 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 14 | ||||
-rw-r--r-- | src/mesa/main/shader_query.cpp | 99 | ||||
-rw-r--r-- | src/mesa/main/shaderobj.c | 4 | ||||
-rw-r--r-- | src/mesa/main/tests/dispatch_sanity.cpp | 11 | ||||
-rw-r--r-- | src/mesa/main/texformat.c | 5 | ||||
-rw-r--r-- | src/mesa/main/version.c | 51 | ||||
-rw-r--r-- | src/mesa/program/prog_parameter.c | 81 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_extensions.c | 13 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 18 | ||||
-rw-r--r-- | src/mesa/state_tracker/st_program.c | 1 | ||||
-rw-r--r-- | src/mesa/vbo/vbo_exec_array.c | 2 |
18 files changed, 193 insertions, 189 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_compiler.c b/src/mesa/drivers/dri/i965/brw_compiler.c index b32252f7b9b..46d9a40c2cf 100644 --- a/src/mesa/drivers/dri/i965/brw_compiler.c +++ b/src/mesa/drivers/dri/i965/brw_compiler.c @@ -148,6 +148,8 @@ brw_compiler_create(void *mem_ctx, const struct brw_device_info *devinfo) brw_fs_alloc_reg_sets(compiler); brw_vec4_alloc_reg_set(compiler); + compiler->precise_trig = env_var_as_boolean("INTEL_PRECISE_TRIG", false); + compiler->scalar_stage[MESA_SHADER_VERTEX] = devinfo->gen >= 8 && !(INTEL_DEBUG & DEBUG_VEC4VS); compiler->scalar_stage[MESA_SHADER_TESS_CTRL] = false; diff --git a/src/mesa/drivers/dri/i965/brw_compiler.h b/src/mesa/drivers/dri/i965/brw_compiler.h index fb5740114dc..cf0b088613b 100644 --- a/src/mesa/drivers/dri/i965/brw_compiler.h +++ b/src/mesa/drivers/dri/i965/brw_compiler.h @@ -92,6 +92,12 @@ struct brw_compiler { bool scalar_stage[MESA_SHADER_STAGES]; struct gl_shader_compiler_options glsl_compiler_options[MESA_SHADER_STAGES]; + + /** + * Apply workarounds for SIN and COS output range problems. + * This can negatively impact performance. + */ + bool precise_trig; }; struct brw_compiler * diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index aa4c745db69..60d58b19ef2 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -765,29 +765,27 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr) inst->saturate = instr->dest.saturate; break; - case nir_op_fsin: { - fs_reg tmp = bld.vgrf(BRW_REGISTER_TYPE_F); - inst = bld.emit(SHADER_OPCODE_SIN, tmp, op[0]); - if (instr->dest.saturate) { - inst->dst = result; - inst->saturate = true; + case nir_op_fsin: + if (!compiler->precise_trig) { + inst = bld.emit(SHADER_OPCODE_SIN, result, op[0]); } else { - bld.MUL(result, tmp, brw_imm_f(0.99997)); + fs_reg tmp = bld.vgrf(BRW_REGISTER_TYPE_F); + inst = bld.emit(SHADER_OPCODE_SIN, tmp, op[0]); + inst = bld.MUL(result, tmp, brw_imm_f(0.99997)); } + inst->saturate = instr->dest.saturate; break; - } - case nir_op_fcos: { - fs_reg tmp = bld.vgrf(BRW_REGISTER_TYPE_F); - inst = bld.emit(SHADER_OPCODE_COS, tmp, op[0]); - if (instr->dest.saturate) { - inst->dst = result; - inst->saturate = true; + case nir_op_fcos: + if (!compiler->precise_trig) { + inst = bld.emit(SHADER_OPCODE_COS, result, op[0]); } else { - bld.MUL(result, tmp, brw_imm_f(0.99997)); + fs_reg tmp = bld.vgrf(BRW_REGISTER_TYPE_F); + inst = bld.emit(SHADER_OPCODE_COS, tmp, op[0]); + inst = bld.MUL(result, tmp, brw_imm_f(0.99997)); } + inst->saturate = instr->dest.saturate; break; - } case nir_op_fddx: if (fs_key->high_quality_derivatives) { diff --git a/src/mesa/drivers/dri/i965/brw_surface_formats.c b/src/mesa/drivers/dri/i965/brw_surface_formats.c index b216dc9d074..fa7878dec82 100644 --- a/src/mesa/drivers/dri/i965/brw_surface_formats.c +++ b/src/mesa/drivers/dri/i965/brw_surface_formats.c @@ -793,7 +793,8 @@ brw_render_target_supported(struct brw_context *brw, /* Under some conditions, MSAA is not supported for formats whose width is * more than 64 bits. */ - if (rb->NumSamples > 0 && _mesa_get_format_bytes(format) > 8) { + if (brw->gen < 8 && + rb->NumSamples > 0 && _mesa_get_format_bytes(format) > 8) { /* Gen6: MSAA on >64 bit formats is unsupported. */ if (brw->gen <= 6) return false; diff --git a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp index a5db2f94d73..4cb03adb2bf 100644 --- a/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_vec4_nir.cpp @@ -1093,29 +1093,27 @@ vec4_visitor::nir_emit_alu(nir_alu_instr *instr) inst->saturate = instr->dest.saturate; break; - case nir_op_fsin: { - src_reg tmp = src_reg(this, glsl_type::vec4_type); - inst = emit_math(SHADER_OPCODE_SIN, dst_reg(tmp), op[0]); - if (instr->dest.saturate) { - inst->dst = dst; - inst->saturate = true; + case nir_op_fsin: + if (!compiler->precise_trig) { + inst = emit_math(SHADER_OPCODE_SIN, dst, op[0]); } else { - emit(MUL(dst, tmp, brw_imm_f(0.99997))); + src_reg tmp = src_reg(this, glsl_type::vec4_type); + inst = emit_math(SHADER_OPCODE_SIN, dst_reg(tmp), op[0]); + inst = emit(MUL(dst, tmp, brw_imm_f(0.99997))); } + inst->saturate = instr->dest.saturate; break; - } - case nir_op_fcos: { - src_reg tmp = src_reg(this, glsl_type::vec4_type); - inst = emit_math(SHADER_OPCODE_COS, dst_reg(tmp), op[0]); - if (instr->dest.saturate) { - inst->dst = dst; - inst->saturate = true; + case nir_op_fcos: + if (!compiler->precise_trig) { + inst = emit_math(SHADER_OPCODE_COS, dst, op[0]); } else { - emit(MUL(dst, tmp, brw_imm_f(0.99997))); + src_reg tmp = src_reg(this, glsl_type::vec4_type); + inst = emit_math(SHADER_OPCODE_COS, dst_reg(tmp), op[0]); + inst = emit(MUL(dst, tmp, brw_imm_f(0.99997))); } + inst->saturate = instr->dest.saturate; break; - } case nir_op_idiv: case nir_op_udiv: diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h index 7c36b1e1d0b..ddc25d812c7 100644 --- a/src/mesa/main/extensions_table.h +++ b/src/mesa/main/extensions_table.h @@ -27,6 +27,7 @@ EXT(APPLE_texture_max_level , dummy_true EXT(APPLE_vertex_array_object , dummy_true , GLL, x , x , x , 2002) EXT(ARB_ES2_compatibility , ARB_ES2_compatibility , GLL, GLC, x , x , 2009) +EXT(ARB_ES3_1_compatibility , ARB_ES3_1_compatibility , x , GLC, x , x , 2014) EXT(ARB_ES3_compatibility , ARB_ES3_compatibility , GLL, GLC, x , x , 2012) EXT(ARB_arrays_of_arrays , ARB_arrays_of_arrays , GLL, GLC, x , x , 2012) EXT(ARB_base_instance , ARB_base_instance , GLL, GLC, x , x , 2011) @@ -176,6 +177,7 @@ EXT(ATI_texture_float , ARB_texture_float EXT(ATI_texture_mirror_once , ATI_texture_mirror_once , GLL, GLC, x , x , 2006) EXT(EXT_abgr , dummy_true , GLL, GLC, x , x , 1995) +EXT(EXT_base_instance , ARB_base_instance , x , x , x , 30, 2014) EXT(EXT_bgra , dummy_true , GLL, x , x , x , 1995) EXT(EXT_blend_color , EXT_blend_color , GLL, x , x , x , 1995) EXT(EXT_blend_equation_separate , EXT_blend_equation_separate , GLL, GLC, x , x , 2003) @@ -213,7 +215,7 @@ EXT(EXT_packed_pixels , dummy_true EXT(EXT_pixel_buffer_object , EXT_pixel_buffer_object , GLL, GLC, x , x , 2004) EXT(EXT_point_parameters , EXT_point_parameters , GLL, x , x , x , 1997) EXT(EXT_polygon_offset , dummy_true , GLL, x , x , x , 1995) -EXT(EXT_polygon_offset_clamp , EXT_polygon_offset_clamp , GLL, GLC, x , x , 2014) +EXT(EXT_polygon_offset_clamp , EXT_polygon_offset_clamp , GLL, GLC, ES1, ES2, 2014) EXT(EXT_provoking_vertex , EXT_provoking_vertex , GLL, GLC, x , x , 2009) EXT(EXT_read_format_bgra , dummy_true , x , x , ES1, ES2, 2009) EXT(EXT_rescale_normal , dummy_true , GLL, x , x , x , 1997) diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py index a0cc4f8e842..33ec60d9ce0 100644 --- a/src/mesa/main/get_hash_params.py +++ b/src/mesa/main/get_hash_params.py @@ -135,6 +135,9 @@ descriptor=[ [ "MAX_LABEL_LENGTH", "CONST(MAX_LABEL_LENGTH), NO_EXTRA" ], [ "MAX_DEBUG_GROUP_STACK_DEPTH", "CONST(MAX_DEBUG_GROUP_STACK_DEPTH), NO_EXTRA" ], [ "DEBUG_GROUP_STACK_DEPTH", "LOC_CUSTOM, TYPE_INT, 0, NO_EXTRA" ], + +# GL_EXT_polygon_offset_clamp + [ "POLYGON_OFFSET_CLAMP_EXT", "CONTEXT_FLOAT(Polygon.OffsetClamp), extra_EXT_polygon_offset_clamp" ], ]}, # Enums in OpenGL and GLES1 @@ -532,7 +535,7 @@ descriptor=[ [ "MAX_GEOMETRY_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters), extra_ARB_shader_atomic_counters_and_geometry_shader" ], # GL_ARB_shader_storage_buffer_object / geometry shader - [ "MAX_GEOMETRY_SHADER_STORAGE_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxShaderStorageBlocks), extra_ARB_shader_storage_buffer_object_and_geometry_shader" ], + [ "MAX_GEOMETRY_SHADER_STORAGE_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxShaderStorageBlocks), extra_ARB_shader_storage_buffer_object_and_geometry_shader" ], # GL_ARB_uniform_buffer_object / geometry shader [ "MAX_GEOMETRY_UNIFORM_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxUniformBlocks), extra_ARB_uniform_buffer_object_and_geometry_shader" ], @@ -857,9 +860,6 @@ descriptor=[ # GL_ARB_shader_image_load_store [ "MAX_IMAGE_SAMPLES", "CONTEXT_INT(Const.MaxImageSamples), extra_ARB_shader_image_load_store" ], -# GL_EXT_polygon_offset_clamp - [ "POLYGON_OFFSET_CLAMP_EXT", "CONTEXT_FLOAT(Polygon.OffsetClamp), extra_EXT_polygon_offset_clamp" ], - # GL_ARB_shader_storage_buffer_object [ "MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_CTRL].MaxShaderStorageBlocks), extra_ARB_shader_storage_buffer_object" ], [ "MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS", "CONTEXT_INT(Const.Program[MESA_SHADER_TESS_EVAL].MaxShaderStorageBlocks), extra_ARB_shader_storage_buffer_object" ], diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index d609ae92e0c..1fbda420401 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2534,6 +2534,9 @@ struct gl_uniform_block */ bool IsShaderStorage; + /** Stages that reference this block */ + uint8_t stageref; + /** * Layout specified in the shader * @@ -2835,16 +2838,6 @@ struct gl_shader_program struct gl_uniform_block **ShaderStorageBlocks; /** - * Indices into the BufferInterfaceBlocks[] array for each stage they're - * used in, or -1. - * - * This is used to maintain the Binding values of the stage's - * BufferInterfaceBlocks[] and to answer the - * GL_UNIFORM_BLOCK_REFERENCED_BY_*_SHADER queries. - */ - int *InterfaceBlockStageIndex[MESA_SHADER_STAGES]; - - /** * Map of active uniform names to locations * * Maps any active uniform that is not an array element to a location. @@ -3786,6 +3779,7 @@ struct gl_extensions GLboolean ANGLE_texture_compression_dxt; GLboolean ARB_ES2_compatibility; GLboolean ARB_ES3_compatibility; + GLboolean ARB_ES3_1_compatibility; GLboolean ARB_arrays_of_arrays; GLboolean ARB_base_instance; GLboolean ARB_blend_func_extended; diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp index 993dc863220..4ef6a81204e 100644 --- a/src/mesa/main/shader_query.cpp +++ b/src/mesa/main/shader_query.cpp @@ -101,31 +101,6 @@ _mesa_BindAttribLocation(GLuint program, GLuint index, */ } -static bool -is_active_attrib(const gl_shader_variable *var) -{ - if (!var) - return false; - - switch (var->mode) { - case ir_var_shader_in: - return var->location != -1; - - case ir_var_system_value: - /* From GL 4.3 core spec, section 11.1.1 (Vertex Attributes): - * "For GetActiveAttrib, all active vertex shader input variables - * are enumerated, including the special built-in inputs gl_VertexID - * and gl_InstanceID." - */ - return var->location == SYSTEM_VALUE_VERTEX_ID || - var->location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE || - var->location == SYSTEM_VALUE_INSTANCE_ID; - - default: - return false; - } -} - void GLAPIENTRY _mesa_GetActiveAttrib(GLuint program, GLuint desired_index, GLsizei maxLength, GLsizei * length, GLint * size, @@ -166,20 +141,8 @@ _mesa_GetActiveAttrib(GLuint program, GLuint desired_index, const gl_shader_variable *const var = RESOURCE_VAR(res); - if (!is_active_attrib(var)) - return; - const char *var_name = var->name; - /* Since gl_VertexID may be lowered to gl_VertexIDMESA, we need to - * consider gl_VertexIDMESA as gl_VertexID for purposes of checking - * active attributes. - */ - if (var->mode == ir_var_system_value && - var->location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) { - var_name = "gl_VertexID"; - } - _mesa_copy_string(name, maxLength, length, var_name); if (size) @@ -224,19 +187,7 @@ _mesa_GetAttribLocation(GLuint program, const GLchar * name) if (!res) return -1; - GLint loc = program_resource_location(shProg, res, name, array_index); - - /* The extra check against against 0 is made because of builtin-attribute - * locations that have offset applied. Function program_resource_location - * can return built-in attribute locations < 0 and glGetAttribLocation - * cannot be used on "conventional" attributes. - * - * From page 95 of the OpenGL 3.0 spec: - * - * "If name is not an active attribute, if name is a conventional - * attribute, or if an error occurs, -1 will be returned." - */ - return (loc >= 0) ? loc : -1; + return program_resource_location(shProg, res, name, array_index); } unsigned @@ -251,8 +202,7 @@ _mesa_count_active_attribs(struct gl_shader_program *shProg) unsigned count = 0; for (unsigned j = 0; j < shProg->NumProgramResourceList; j++, res++) { if (res->Type == GL_PROGRAM_INPUT && - res->StageReferences & (1 << MESA_SHADER_VERTEX) && - is_active_attrib(RESOURCE_VAR(res))) + res->StageReferences & (1 << MESA_SHADER_VERTEX)) count++; } return count; @@ -410,25 +360,12 @@ _mesa_GetFragDataLocation(GLuint program, const GLchar *name) if (!res) return -1; - GLint loc = program_resource_location(shProg, res, name, array_index); - - /* The extra check against against 0 is made because of builtin-attribute - * locations that have offset applied. Function program_resource_location - * can return built-in attribute locations < 0 and glGetFragDataLocation - * cannot be used on "conventional" attributes. - * - * From page 95 of the OpenGL 3.0 spec: - * - * "If name is not an active attribute, if name is a conventional - * attribute, or if an error occurs, -1 will be returned." - */ - return (loc >= 0) ? loc : -1; + return program_resource_location(shProg, res, name, array_index); } const char* _mesa_program_resource_name(struct gl_program_resource *res) { - const gl_shader_variable *var; switch (res->Type) { case GL_UNIFORM_BLOCK: case GL_SHADER_STORAGE_BLOCK: @@ -436,13 +373,6 @@ _mesa_program_resource_name(struct gl_program_resource *res) case GL_TRANSFORM_FEEDBACK_VARYING: return RESOURCE_XFV(res)->Name; case GL_PROGRAM_INPUT: - var = RESOURCE_VAR(res); - /* Special case gl_VertexIDMESA -> gl_VertexID. */ - if (var->mode == ir_var_system_value && - var->location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) { - return "gl_VertexID"; - } - /* fallthrough */ case GL_PROGRAM_OUTPUT: return RESOURCE_VAR(res)->name; case GL_UNIFORM: @@ -850,34 +780,31 @@ program_resource_location(struct gl_shader_program *shProg, struct gl_program_resource *res, const char *name, unsigned array_index) { - /* Built-in locations should report GL_INVALID_INDEX. */ - if (is_gl_identifier(name)) - return GL_INVALID_INDEX; - - /* VERT_ATTRIB_GENERIC0 and FRAG_RESULT_DATA0 are decremented as these - * offsets are used internally to differentiate between built-in attributes - * and user-defined attributes. - */ switch (res->Type) { case GL_PROGRAM_INPUT: { const gl_shader_variable *var = RESOURCE_VAR(res); + if (var->location == -1) + return -1; + /* If the input is an array, fail if the index is out of bounds. */ if (array_index > 0 && array_index >= var->type->length) { return -1; } - return (var->location + - (array_index * var->type->without_array()->matrix_columns) - - VERT_ATTRIB_GENERIC0); + return var->location + + (array_index * var->type->without_array()->matrix_columns); } case GL_PROGRAM_OUTPUT: + if (RESOURCE_VAR(res)->location == -1) + return -1; + /* If the output is an array, fail if the index is out of bounds. */ if (array_index > 0 && array_index >= RESOURCE_VAR(res)->type->length) { return -1; } - return RESOURCE_VAR(res)->location + array_index - FRAG_RESULT_DATA0; + return RESOURCE_VAR(res)->location + array_index; case GL_UNIFORM: /* If the uniform is built-in, fail. */ if (RESOURCE_UNI(res)->builtin) @@ -999,7 +926,7 @@ is_resource_referenced(struct gl_shader_program *shProg, return RESOURCE_ATC(res)->StageReferences[stage]; if (res->Type == GL_UNIFORM_BLOCK || res->Type == GL_SHADER_STORAGE_BLOCK) - return shProg->InterfaceBlockStageIndex[stage][index] != -1; + return shProg->BufferInterfaceBlocks[index].stageref & (1 << stage); return res->StageReferences & (1 << stage); } diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 9a4eb6b56fd..8b9166ceecb 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -295,10 +295,6 @@ _mesa_clear_shader_program_data(struct gl_shader_program *shProg) ralloc_free(shProg->BufferInterfaceBlocks); shProg->BufferInterfaceBlocks = NULL; shProg->NumBufferInterfaceBlocks = 0; - for (i = 0; i < MESA_SHADER_STAGES; i++) { - ralloc_free(shProg->InterfaceBlockStageIndex[i]); - shProg->InterfaceBlockStageIndex[i] = NULL; - } ralloc_free(shProg->AtomicBuffers); shProg->AtomicBuffers = NULL; diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index 9f278be47ca..c85bc54fe35 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -2064,6 +2064,9 @@ const struct function gles11_functions_possible[] = { { "glObjectLabelKHR", 11, -1 }, { "glObjectPtrLabelKHR", 11, -1 }, + /* GL_EXT_polygon_offset_clamp */ + { "glPolygonOffsetClampEXT", 11, -1 }, + { NULL, 0, -1 } }; @@ -2300,6 +2303,9 @@ const struct function gles2_functions_possible[] = { { "glObjectLabelKHR", 20, -1 }, { "glObjectPtrLabelKHR", 20, -1 }, + /* GL_EXT_polygon_offset_clamp */ + { "glPolygonOffsetClampEXT", 11, -1 }, + { NULL, 0, -1 } }; @@ -2470,6 +2476,11 @@ const struct function gles3_functions_possible[] = { { "glDisableiOES", 30, -1 }, { "glIsEnablediOES", 30, -1 }, + /* GL_EXT_base_instance */ + { "glDrawArraysInstancedBaseInstanceEXT", 30, -1 }, + { "glDrawElementsInstancedBaseInstanceEXT", 30, -1 }, + { "glDrawElementsInstancedBaseVertexBaseInstanceEXT", 30, -1 }, + { NULL, 0, -1 } }; diff --git a/src/mesa/main/texformat.c b/src/mesa/main/texformat.c index 419fd78e893..be2581b004f 100644 --- a/src/mesa/main/texformat.c +++ b/src/mesa/main/texformat.c @@ -765,6 +765,11 @@ _mesa_choose_tex_format(struct gl_context *ctx, GLenum target, RETURN_IF_SUPPORTED(MESA_FORMAT_B8G8R8A8_UNORM); break; + case GL_STENCIL_INDEX: + case GL_STENCIL_INDEX8: + RETURN_IF_SUPPORTED(MESA_FORMAT_S_UINT8); + break; + default: /* For non-generic compressed format we assert two things: * diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 112a73dc0e7..2af3653f7bb 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -351,8 +351,55 @@ compute_version(const struct gl_extensions *extensions, extensions->ARB_shading_language_packing && extensions->ARB_texture_compression_bptc && extensions->ARB_transform_feedback_instanced); - - if (ver_4_2) { + const bool ver_4_3 = (ver_4_2 && + consts->GLSLVersion >= 430 && + extensions->ARB_ES3_compatibility && + extensions->ARB_arrays_of_arrays && + extensions->ARB_compute_shader && + extensions->ARB_copy_image && + extensions->ARB_explicit_uniform_location && + extensions->ARB_fragment_layer_viewport && + extensions->ARB_framebuffer_no_attachments && + extensions->ARB_internalformat_query2 && + /* extensions->ARB_robust_buffer_access_behavior */ 0 && + extensions->ARB_shader_image_size && + extensions->ARB_shader_storage_buffer_object && + extensions->ARB_stencil_texturing && + extensions->ARB_texture_buffer_range && + extensions->ARB_texture_query_levels && + extensions->ARB_texture_view); + const bool ver_4_4 = (ver_4_3 && + consts->GLSLVersion >= 440 && + extensions->ARB_buffer_storage && + extensions->ARB_clear_texture && + extensions->ARB_enhanced_layouts && + extensions->ARB_query_buffer_object && + extensions->ARB_texture_mirror_clamp_to_edge && + extensions->ARB_texture_stencil8 && + extensions->ARB_vertex_type_10f_11f_11f_rev); + const bool ver_4_5 = (ver_4_4 && + consts->GLSLVersion >= 450 && + extensions->ARB_ES3_1_compatibility && + extensions->ARB_clip_control && + extensions->ARB_conditional_render_inverted && + /* extensions->ARB_cull_distance */ 0 && + extensions->ARB_derivative_control && + extensions->ARB_shader_texture_image_samples && + extensions->NV_texture_barrier); + + if (ver_4_5) { + major = 4; + minor = 5; + } + else if (ver_4_4) { + major = 4; + minor = 4; + } + else if (ver_4_3) { + major = 4; + minor = 3; + } + else if (ver_4_2) { major = 4; minor = 2; } diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index 02d84f20cd8..c294b005b85 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -248,54 +248,51 @@ _mesa_add_parameter(struct gl_program_parameter_list *paramList, paramList->Size = 0; return -1; } - else { - GLuint i, j; - - paramList->NumParameters = oldNum + sz4; - - memset(¶mList->Parameters[oldNum], 0, - sz4 * sizeof(struct gl_program_parameter)); - - for (i = 0; i < sz4; i++) { - struct gl_program_parameter *p = paramList->Parameters + oldNum + i; - p->Name = name ? strdup(name) : NULL; - p->Type = type; - p->Size = size; - p->DataType = datatype; - if (values) { - if (size >= 4) { - COPY_4V(paramList->ParameterValues[oldNum + i], values); + + GLuint i, j; + + paramList->NumParameters = oldNum + sz4; + + memset(¶mList->Parameters[oldNum], 0, + sz4 * sizeof(struct gl_program_parameter)); + + for (i = 0; i < sz4; i++) { + struct gl_program_parameter *p = paramList->Parameters + oldNum + i; + p->Name = name ? strdup(name) : NULL; + p->Type = type; + p->Size = size; + p->DataType = datatype; + if (values) { + if (size >= 4) { + COPY_4V(paramList->ParameterValues[oldNum + i], values); + } else { + /* copy 1, 2 or 3 values */ + GLuint remaining = size % 4; + assert(remaining < 4); + for (j = 0; j < remaining; j++) { + paramList->ParameterValues[oldNum + i][j].f = values[j].f; } - else { - /* copy 1, 2 or 3 values */ - GLuint remaining = size % 4; - assert(remaining < 4); - for (j = 0; j < remaining; j++) { - paramList->ParameterValues[oldNum + i][j].f = values[j].f; - } - /* fill in remaining positions with zeros */ - for (; j < 4; j++) { - paramList->ParameterValues[oldNum + i][j].f = 0.0f; - } + /* fill in remaining positions with zeros */ + for (; j < 4; j++) { + paramList->ParameterValues[oldNum + i][j].f = 0.0f; } - values += 4; - p->Initialized = GL_TRUE; } - else { - /* silence valgrind */ - for (j = 0; j < 4; j++) - paramList->ParameterValues[oldNum + i][j].f = 0; - } - size -= 4; - } - - if (state) { - for (i = 0; i < STATE_LENGTH; i++) - paramList->Parameters[oldNum].StateIndexes[i] = state[i]; + values += 4; + p->Initialized = GL_TRUE; + } else { + /* silence valgrind */ + for (j = 0; j < 4; j++) + paramList->ParameterValues[oldNum + i][j].f = 0; } + size -= 4; + } - return (GLint) oldNum; + if (state) { + for (i = 0; i < STATE_LENGTH; i++) + paramList->Parameters[oldNum].StateIndexes[i] = state[i]; } + + return (GLint) oldNum; } diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index 8748ab5c876..6c0df8d2a98 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1124,14 +1124,15 @@ void st_init_extensions(struct pipe_screen *screen, if (compute_supported_irs & (1 << PIPE_SHADER_IR_TGSI)) { uint64_t grid_size[3], block_size[3]; - screen->get_compute_param(screen, PIPE_COMPUTE_CAP_MAX_GRID_SIZE, - grid_size); - screen->get_compute_param(screen, PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE, - block_size); - screen->get_compute_param(screen, + screen->get_compute_param(screen, PIPE_SHADER_IR_TGSI, + PIPE_COMPUTE_CAP_MAX_GRID_SIZE, grid_size); + screen->get_compute_param(screen, PIPE_SHADER_IR_TGSI, + PIPE_COMPUTE_CAP_MAX_BLOCK_SIZE, block_size); + screen->get_compute_param(screen, PIPE_SHADER_IR_TGSI, PIPE_COMPUTE_CAP_MAX_THREADS_PER_BLOCK, &consts->MaxComputeWorkGroupInvocations); - screen->get_compute_param(screen, PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE, + screen->get_compute_param(screen, PIPE_SHADER_IR_TGSI, + PIPE_COMPUTE_CAP_MAX_LOCAL_SIZE, &consts->MaxComputeSharedMemorySize); for (i = 0; i < 3; i++) { diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp index 23786b85529..cd481c166e7 100644 --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp @@ -5935,6 +5935,20 @@ find_array(unsigned attr, struct array_decl *arrays, unsigned count, return false; } +static void +emit_compute_block_size(const struct gl_program *program, + struct ureg_program *ureg) { + const struct gl_compute_program *cp = + (const struct gl_compute_program *)program; + + ureg_property(ureg, TGSI_PROPERTY_CS_FIXED_BLOCK_WIDTH, + cp->LocalSize[0]); + ureg_property(ureg, TGSI_PROPERTY_CS_FIXED_BLOCK_HEIGHT, + cp->LocalSize[1]); + ureg_property(ureg, TGSI_PROPERTY_CS_FIXED_BLOCK_DEPTH, + cp->LocalSize[2]); +} + /** * Translate intermediate IR (glsl_to_tgsi_instruction) to TGSI format. * \param program the program to translate @@ -6180,6 +6194,10 @@ st_translate_program( } } + if (procType == TGSI_PROCESSOR_COMPUTE) { + emit_compute_block_size(proginfo, ureg); + } + /* Declare address register. */ if (program->num_address_regs > 0) { diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index 94dc48971ec..d2d68ac05bf 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -1463,6 +1463,7 @@ st_translate_compute_program(struct st_context *st, st_translate_program_common(st, &stcp->Base.Base, stcp->glsl_to_tgsi, ureg, TGSI_PROCESSOR_COMPUTE, &prog); + stcp->tgsi.ir_type = PIPE_SHADER_IR_TGSI; stcp->tgsi.prog = prog.tokens; stcp->tgsi.req_local_mem = stcp->Base.SharedSize; stcp->tgsi.req_private_mem = 0; diff --git a/src/mesa/vbo/vbo_exec_array.c b/src/mesa/vbo/vbo_exec_array.c index f0245fd08cc..40cf3fff126 100644 --- a/src/mesa/vbo/vbo_exec_array.c +++ b/src/mesa/vbo/vbo_exec_array.c @@ -1739,7 +1739,7 @@ vbo_initialize_exec_dispatch(const struct gl_context *ctx, } } - if (_mesa_is_desktop_gl(ctx)) { + if (_mesa_is_desktop_gl(ctx) || _mesa_is_gles3(ctx)) { SET_DrawArraysInstancedBaseInstance(exec, vbo_exec_DrawArraysInstancedBaseInstance); SET_DrawElementsInstancedBaseInstance(exec, vbo_exec_DrawElementsInstancedBaseInstance); SET_DrawElementsInstancedBaseVertexBaseInstance(exec, vbo_exec_DrawElementsInstancedBaseVertexBaseInstance); |