diff --git a/docs/gallium/screen.rst b/docs/gallium/screen.rst index 8cddec99f82..037f63c0381 100644 --- a/docs/gallium/screen.rst +++ b/docs/gallium/screen.rst @@ -276,13 +276,6 @@ The integer capabilities: * ``PIPE_CAP_CLIP_HALFZ``: Whether the driver supports the pipe_rasterizer_state::clip_halfz being set to true. This is required for enabling ARB_clip_control. -* ``PIPE_CAP_VERTEXID_NOBASE``: If true, the driver only supports - TGSI_SEMANTIC_VERTEXID_NOBASE (and not TGSI_SEMANTIC_VERTEXID). This means - gallium frontends for APIs whose vertexIDs are offset by basevertex (such as GL) - will need to lower TGSI_SEMANTIC_VERTEXID to TGSI_SEMANTIC_VERTEXID_NOBASE - and TGSI_SEMANTIC_BASEVERTEX, so drivers setting this must handle both these - semantics. Only relevant if geometry shaders are supported. - (BASEVERTEX could be exposed separately too via ``PIPE_CAP_DRAW_PARAMETERS``). * ``PIPE_CAP_POLYGON_OFFSET_CLAMP``: If true, the driver implements support for ``pipe_rasterizer_state::offset_clamp``. * ``PIPE_CAP_MULTISAMPLE_Z_RESOLVE``: Whether the driver supports blitting diff --git a/src/compiler/glsl/ir_optimization.h b/src/compiler/glsl/ir_optimization.h index 84a5430e8ca..1ac7d8bcaeb 100644 --- a/src/compiler/glsl/ir_optimization.h +++ b/src/compiler/glsl/ir_optimization.h @@ -122,7 +122,6 @@ void optimize_dead_builtin_variables(exec_list *instructions, enum ir_variable_mode other); bool lower_tess_level(gl_linked_shader *shader); -bool lower_vertex_id(gl_linked_shader *shader); bool lower_cs_derived(gl_linked_shader *shader); bool lower_blend_equation_advanced(gl_linked_shader *shader, bool coherent); diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index e7748f9a48a..19772918ef3 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2544,9 +2544,6 @@ link_intrastage_shaders(void *mem_ctx, } } - if (ctx->Const.VertexID_is_zero_based) - lower_vertex_id(linked); - if (ctx->Const.LowerCsDerivedVariables) lower_cs_derived(linked); diff --git a/src/compiler/glsl/lower_vertex_id.cpp b/src/compiler/glsl/lower_vertex_id.cpp deleted file mode 100644 index 6092255ca27..00000000000 --- a/src/compiler/glsl/lower_vertex_id.cpp +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright © 2014 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/** - * \file lower_vertex_id.cpp - * - * There exists hardware, such as i965, that does not implement the OpenGL - * semantic for gl_VertexID. Instead, that hardware does not include the - * value of basevertex in the gl_VertexID value. To implement the OpenGL - * semantic, we'll have to convert gl_Vertex_ID to - * gl_VertexIDMESA+gl_BaseVertexMESA. - */ - -#include "glsl_symbol_table.h" -#include "ir_hierarchical_visitor.h" -#include "ir.h" -#include "ir_builder.h" -#include "linker.h" -#include "program/prog_statevars.h" -#include "builtin_functions.h" -#include "main/shader_types.h" - -namespace { - -class lower_vertex_id_visitor : public ir_hierarchical_visitor { -public: - explicit lower_vertex_id_visitor(ir_function_signature *main_sig, - exec_list *ir_list) - : progress(false), VertexID(NULL), gl_VertexID(NULL), - gl_BaseVertex(NULL), main_sig(main_sig), ir_list(ir_list) - { - foreach_in_list(ir_instruction, ir, ir_list) { - ir_variable *const var = ir->as_variable(); - - if (var != NULL && var->data.mode == ir_var_system_value && - var->data.location == SYSTEM_VALUE_BASE_VERTEX) { - gl_BaseVertex = var; - break; - } - } - } - - virtual ir_visitor_status visit(ir_dereference_variable *); - - bool progress; - -private: - ir_variable *VertexID; - ir_variable *gl_VertexID; - ir_variable *gl_BaseVertex; - - ir_function_signature *main_sig; - exec_list *ir_list; -}; - -} /* anonymous namespace */ - -ir_visitor_status -lower_vertex_id_visitor::visit(ir_dereference_variable *ir) -{ - if (ir->var->data.mode != ir_var_system_value || - ir->var->data.location != SYSTEM_VALUE_VERTEX_ID) - return visit_continue; - - if (VertexID == NULL) { - const glsl_type *const int_t = glsl_type::int_type; - void *const mem_ctx = ralloc_parent(ir); - - VertexID = new(mem_ctx) ir_variable(int_t, "__VertexID", - ir_var_temporary); - ir_list->push_head(VertexID); - - gl_VertexID = new(mem_ctx) ir_variable(int_t, "gl_VertexIDMESA", - ir_var_system_value); - gl_VertexID->data.how_declared = ir_var_declared_implicitly; - gl_VertexID->data.read_only = true; - gl_VertexID->data.location = SYSTEM_VALUE_VERTEX_ID_ZERO_BASE; - gl_VertexID->data.explicit_location = true; - gl_VertexID->data.explicit_index = 0; - ir_list->push_head(gl_VertexID); - - if (gl_BaseVertex == NULL) { - gl_BaseVertex = new(mem_ctx) ir_variable(int_t, "gl_BaseVertex", - ir_var_system_value); - gl_BaseVertex->data.how_declared = ir_var_hidden; - gl_BaseVertex->data.read_only = true; - gl_BaseVertex->data.location = SYSTEM_VALUE_BASE_VERTEX; - gl_BaseVertex->data.explicit_location = true; - gl_BaseVertex->data.explicit_index = 0; - ir_list->push_head(gl_BaseVertex); - } - - ir_instruction *const inst = - ir_builder::assign(VertexID, - ir_builder::add(gl_VertexID, gl_BaseVertex)); - - main_sig->body.push_head(inst); - } - - ir->var = VertexID; - progress = true; - - return visit_continue; -} - -bool -lower_vertex_id(gl_linked_shader *shader) -{ - /* gl_VertexID only exists in the vertex shader. - */ - if (shader->Stage != MESA_SHADER_VERTEX) - return false; - - ir_function_signature *const main_sig = - _mesa_get_main_function_signature(shader->symbols); - if (main_sig == NULL) { - assert(main_sig != NULL); - return false; - } - - lower_vertex_id_visitor v(main_sig, shader->ir); - - v.run(shader->ir); - - return v.progress; -} diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build index f8c4790f348..55cba69384e 100644 --- a/src/compiler/glsl/meson.build +++ b/src/compiler/glsl/meson.build @@ -173,7 +173,6 @@ files_libglsl = files( 'lower_vec_index_to_swizzle.cpp', 'lower_vector_derefs.cpp', 'lower_vector_insert.cpp', - 'lower_vertex_id.cpp', 'lower_output_reads.cpp', 'opt_algebraic.cpp', 'opt_array_splitting.cpp', diff --git a/src/gallium/auxiliary/util/u_screen.c b/src/gallium/auxiliary/util/u_screen.c index ca4d5ef0f38..391ec743984 100644 --- a/src/gallium/auxiliary/util/u_screen.c +++ b/src/gallium/auxiliary/util/u_screen.c @@ -226,7 +226,6 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen, case PIPE_CAP_SAMPLER_VIEW_TARGET: case PIPE_CAP_CLIP_HALFZ: - case PIPE_CAP_VERTEXID_NOBASE: case PIPE_CAP_POLYGON_OFFSET_CLAMP: case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: diff --git a/src/gallium/drivers/nouveau/nv30/nv30_screen.c b/src/gallium/drivers/nouveau/nv30/nv30_screen.c index 7fb6ecb605a..71e92d158ad 100644 --- a/src/gallium/drivers/nouveau/nv30/nv30_screen.c +++ b/src/gallium/drivers/nouveau/nv30/nv30_screen.c @@ -180,7 +180,6 @@ nv30_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_CONDITIONAL_RENDER_INVERTED: case PIPE_CAP_SAMPLER_VIEW_TARGET: case PIPE_CAP_CLIP_HALFZ: - case PIPE_CAP_VERTEXID_NOBASE: case PIPE_CAP_POLYGON_OFFSET_CLAMP: case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: diff --git a/src/gallium/drivers/nouveau/nv50/nv50_screen.c b/src/gallium/drivers/nouveau/nv50/nv50_screen.c index dadd7d62ce8..db329c40e9a 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_screen.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_screen.c @@ -315,7 +315,6 @@ nv50_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_DRAW_INDIRECT: case PIPE_CAP_MULTI_DRAW_INDIRECT: case PIPE_CAP_MULTI_DRAW_INDIRECT_PARAMS: - case PIPE_CAP_VERTEXID_NOBASE: case PIPE_CAP_MULTISAMPLE_Z_RESOLVE: /* potentially supported on some hw */ case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY_COMPUTE_ONLY: diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c index 909e983ed00..33ce857c903 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_screen.c @@ -371,7 +371,6 @@ nvc0_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param) case PIPE_CAP_VERTEX_ATTRIB_ELEMENT_ALIGNED_ONLY: case PIPE_CAP_FAKE_SW_MSAA: case PIPE_CAP_VS_WINDOW_SPACE_POSITION: - case PIPE_CAP_VERTEXID_NOBASE: case PIPE_CAP_RESOURCE_FROM_USER_MEMORY: case PIPE_CAP_FS_POSITION_IS_SYSVAL: case PIPE_CAP_FS_POINT_IS_SYSVAL: diff --git a/src/gallium/include/pipe/p_defines.h b/src/gallium/include/pipe/p_defines.h index 96a95cc38c8..ad79a91c572 100644 --- a/src/gallium/include/pipe/p_defines.h +++ b/src/gallium/include/pipe/p_defines.h @@ -830,7 +830,6 @@ enum pipe_cap PIPE_CAP_MAX_VERTEX_ATTRIB_STRIDE, PIPE_CAP_SAMPLER_VIEW_TARGET, PIPE_CAP_CLIP_HALFZ, - PIPE_CAP_VERTEXID_NOBASE, PIPE_CAP_POLYGON_OFFSET_CLAMP, PIPE_CAP_MULTISAMPLE_Z_RESOLVE, PIPE_CAP_RESOURCE_FROM_USER_MEMORY, diff --git a/src/intel/compiler/brw_vec4_nir.cpp b/src/intel/compiler/brw_vec4_nir.cpp index 6010620dd08..f871c0d340d 100644 --- a/src/intel/compiler/brw_vec4_nir.cpp +++ b/src/intel/compiler/brw_vec4_nir.cpp @@ -549,7 +549,7 @@ vec4_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr) break; case nir_intrinsic_load_vertex_id: - unreachable("should be lowered by lower_vertex_id()"); + unreachable("should be lowered by vertex_id_zero_based"); case nir_intrinsic_load_vertex_id_zero_base: case nir_intrinsic_load_base_vertex: diff --git a/src/mesa/main/consts_exts.h b/src/mesa/main/consts_exts.h index 17f3586ffd8..6fdb89c890e 100644 --- a/src/mesa/main/consts_exts.h +++ b/src/mesa/main/consts_exts.h @@ -697,15 +697,6 @@ struct gl_constants */ GLboolean NativeIntegers; - /** - * Does VertexID count from zero or from base vertex? - * - * \note - * If desktop GLSL 1.30 or GLSL ES 3.00 are not supported, this field is - * ignored and need not be set. - */ - bool VertexID_is_zero_based; - /** * If the driver supports real 32-bit integers, what integer value should be * used for boolean true in uniform uploads? (Usually 1 or ~0.) diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index 5b5850bc49b..0842c2fb6d6 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -481,12 +481,6 @@ _mesa_init_constants(struct gl_constants *consts, gl_api api) consts->GLSLLowerConstArrays = true; - /* Assume that if GLSL 1.30+ (or GLSL ES 3.00+) is supported that - * gl_VertexID is implemented using a native hardware register with OpenGL - * semantics. - */ - consts->VertexID_is_zero_based = false; - /* GL_ARB_draw_buffers */ consts->MaxDrawBuffers = MAX_DRAW_BUFFERS; diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index cbb8a3eeb0a..b4288ebabee 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -1210,10 +1210,6 @@ void st_init_extensions(struct pipe_screen *screen, if (drv_clip_planes > 1) consts->MaxClipPlanes = drv_clip_planes; - if (screen->get_param(screen, PIPE_CAP_VERTEXID_NOBASE)) { - consts->VertexID_is_zero_based = GL_TRUE; - } - /* Extensions that either depend on GLSL 1.30 or are a subset thereof. */ extensions->ARB_conservative_depth = GL_TRUE; extensions->ARB_shading_language_packing = GL_TRUE;