summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/glspirv.c
Commit message (Collapse)AuthorAgeFilesLines
* nir/validate: Print when the validation failedJason Ekstrand2018-10-261-1/+1
| | | | | Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
* glspirv: drop pointless assert (size_t is unsigned)Dave Airlie2018-10-111-2/+0
| | | | | | Found by coverity Reviewed-by: Alejandro Piñeiro <[email protected]>
* nir: Drop the vs_inputs_dual_locations optionJason Ekstrand2018-09-061-6/+2
| | | | | | | | | | | | | It was very inconsistently handled; the only things that made use of it were glsl_to_nir, glspirv, and nir_gather_info. In particular, nir_lower_io completely ignored it so anyone using nir_lower_io on 64-bit vertex attributes was going to be in for a shock. Also, as of the previous commit, it's set by every driver that supports 64-bit vertex attributes. There's no longer any reason to have it be an option so let's just delete it. Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* compiler: Move double_inputs to gl_program::DualSlotInputsJason Ekstrand2018-09-061-16/+4
| | | | | | | | | | | | | | | | | | | | | | | Previously, we had two field in shader_info: double_inputs_read and double_inputs. Presumably, the one was for all double inputs that are read and the other is all that exist. However, because nir_gather_info regenerates these two values, there is a possibility, if a variable gets deleted, that the value of double_inputs could change over time. This is a problem because double_inputs is used to remap the input locations to a two-slot-per-dvec3/4 scheme for i965. If that mapping were to change between glsl_to_nir and back-end state setup, we would fall over when trying to map the NIR outputs back onto the GL location space. This commit changes the way slot re-mapping works. Instead of the double_inputs field in shader_info, it adds a DualSlotInputs bitfield to gl_program. By having it in gl_program, we more easily guarantee that NIR passes won't touch it after it's been set. It also makes more sense to put it in a GL data structure since it's really a mapping from GL slots to back-end and/or NIR slots and not really a NIR shader thing. Tested-by: Alejandro Piñeiro <[email protected]> (ARB_gl_spirv tests) Reviewed-by: Alejandro Piñeiro <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa/glspirv: fix compilation with MSVCAlejandro Piñeiro2018-08-131-1/+1
| | | | | | | From AppVeyor #8582, it seems that MSVC doesn't like uint, so this patch replaces it with unsigned. Reviewed-by: Roland Scheidegger <[email protected]>
* mesa/glspirv: Set separate_shader on shader_infoNeil Roberts2018-08-131-0/+2
| | | | | | | | | The value is copied from the gl_program. If we don’t do this then it will get reset back to zero in brw_shader_gather_info. This isn’t a problem for GLSL because in that case the nir_shader is initialised with a copy of the shader_info from the gl_program. Reviewed-by: Timothy Arceri <[email protected]>
* mesa/glspirv: pick off the only entry point we needIago Toral Quiroga2018-08-131-0/+15
| | | | | | | | | This is the same we do for vulkan drivers This is needed to pass the following CTS test: KHR-GL45.gl_spirv.spirv_modules_shader_binary_multiple_shader_objects_test Reviewed-by: Timothy Arceri <[email protected]>
* mesa/glspirv: compute double inputs and remap attributesAlejandro Piñeiro2018-08-131-0/+19
| | | | | | | | | | | | | | input locations used by input attributes are not handled in the same way in OpenGL vs Vulkan. There is a detailed explanation of such differences on the following commit: c2acf97fcc9b32eaa9778771282758e5652a8ad4 So with this commit, the same adjustment that is done after glsl_to_nir, is being done after spirv_to_nir, when it is used on OpenGL (ARB_gl_spirv). Reviewed-by: Timothy Arceri <[email protected]>
* arb_gl_spirv: add calls to several nir loweringsAlejandro Piñeiro2018-07-311-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | For now we are just adding nir lowerings that are needed/mandatory to get things working. After everything is settled, we would start to add good-to-have lowerings. This patch adds the following calls: * nir_split_var_copits and nir_split_per_member_structs: as vulkan drivers are doing now. See commit b0c643d8f579a3e1e45a08f6d9de099f2c45898b ("spirv: Use NIR per-member splitting") for more info. Without this commit, piglit tests like this crashes: spec/arb_gl_spirv/execution/varying/block And in general most of the shaders that includes any kind of struct. * nir_copy_prop: after nir_deref_instr introduction, function calls need this. See commit "nir,spirv: Rework function calls" (c11833ab24dcba26de1b0a5805e35a5d6761514e) for more info. Reviewed-by: Timothy Arceri <[email protected]>
* mesa/glspirv: Set last_vert_progNeil Roberts2018-07-311-0/+7
| | | | | | v2: simplify last_vert check (Timothy) Reviewed-by: Timothy Arceri <[email protected]>
* mesa/glspirv: lower workgroup access to offsetsAntia Puentes2018-07-031-0/+1
| | | | | | This will perform the CS shared lowering. See 8761a04d0d93 Reviewed-by: Timothy Arceri <[email protected]>
* mesa: include mtypes.h lessMarek Olšák2018-04-121-0/+1
| | | | | | | | | | - remove mtypes.h from most header files - add main/menums.h for often used definitions - remove main/core.h v2: fix radv build Reviewed-by: Brian Paul <[email protected]>
* mesa/glspirv: Add a _mesa_spirv_to_nir() functionEduardo Lima Mitev2018-03-301-0/+58
| | | | | | | | | | | This is basically a wrapper around spirv_to_nir() that includes arguments setup and post-conversion validation. v2: * Rebase update (SpirVCapabilities not a pointer anymore, spirv_to_nir_options added, and others). * Code-style improvements and remove debug hunk. (Timothy Arceri) Reviewed-by: Timothy Arceri <[email protected]>
* mesa/glspirv: Add _mesa_spirv_link_shaders() functionEduardo Lima Mitev2018-03-301-0/+71
| | | | | | | | | | | | | | | | | | | This is the equivalent to link_shaders() from src/compiler/glsl/linker.cpp, but for SPIR-V programs. It just creates the program and its gl_linked_shader objects, giving drivers the opportunity to implement any linking of SPIR-V shaders they choose, at a later stage. v2: Bail out if we see more that one shader for the same stage, and add a corresponding comment. (Timothy Arceri) v3: * Adds also a linker error log to the condition above, with a reference to the specification issue. (Timothy Arceri) * Squash with the patch adding the function boilerplate (Timothy Arceri) Reviewed-by: Timothy Arceri <[email protected]>
* mesa: Implement glSpecializeShaderARBNicolai Hähnle2018-03-301-2/+105
| | | | | | | | | | | | | | | | | v2: * Use gl_spirv_validation instead of spirv_to_nir. This method just validates the shader. The conversion to NIR will happen later, during linking. (Alejandro Piñeiro) * Use gl_shader_spirv_data struct to store the SPIR-V data. (Eduardo Lima) * Use the 'spirv_data' member to tell if the gl_shader is a SPIR-V shader, instead of a dedicated flag. (Timothy Arceri) Signed-off-by: Nicolai Hähnle <[email protected]> Signed-off-by: Alejandro Piñeiro <[email protected]> Signed-off-by: Eduardo Lima Mitev <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>
* mesa: change gl_compile_status enums to uppercaseBrian Paul2018-01-261-1/+1
| | | | | | To follow the convention of other enums. Reviewed-by: Neha Bhende <[email protected]>
* mesa: remove second include of errors.h in src/mesa/main/glspirv.cKai Wasserbäch2017-12-121-4/+0
| | | | | | Fixes: 5bc03d2508 ("mesa: implement SPIR-V loading in glShaderBinary") Signed-off-by: Kai Wasserbäch <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: implement SPIR-V loading in glShaderBinaryNicolai Hähnle2017-12-121-0/+43
| | | | | | | | | | | | | | | | | | v2: * Add a gl_shader_spirv_data member to gl_shader, which already encapsulates a gl_spirv_module where the binary will be saved. (Eduardo Lima) * Just use the 'spirv_data' member to know whether a gl_shader has the SPIR_V_BINARY_ARB state. (Timothy Arceri) * Remove redundant argument checks. Move extension presence check to API entry point where the rest of checks are. Retype 'n' and 'length'arguments to use the correct and more standard types. (Ian Romanick) * Fix some nitpicks. (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* mesa/glspirv: Add struct gl_shader_spirv_dataEduardo Lima Mitev2017-12-121-0/+17
| | | | | | | | | | | | | | | | | This is a per-shader structure holding the SPIR-V data associated with the shader (binary module, specialization constants and entry-point). This is needed because both gl_shader and gl_linked_shader need to share this data. Instead of copying the data, we pass a reference to it upon program linking. That's why it is reference-counted. This struct is created and associated with the shader upon calling glShaderBinary(), then subsequently filled up by the call to glSpecializeShaderARB(). v2: Readability improvements (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* mesa/glspirv: Add struct gl_spirv_moduleNicolai Hähnle2017-12-121-0/+17
| | | | | | | | | v2: * Make the SPIR-V module struct part of a larger gl_shader_spirv_data struct that will be introduced later, and don't reference it directly in gl_shader. (Eduardo Lima) * Readability improvements (Ian Romanick) Reviewed-by: Ian Romanick <[email protected]>
* mesa: add GL_ARB_gl_spirv boilerplateNicolai Hähnle2017-12-121-0/+39
v2: * Add meson build bits (Eric Engestrom) * Return INVALID_OPERATION error on SpecializeShaderARB (Ian Romanick) v3: Include boilerplate for the GL 4.6 alias of glSpecializeShaderARB (Neil Roberts) Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Timothy Arceri <[email protected]>