summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* nir/glsl_to_nir: ignore an instruction's dest if it hasn't anyIago Toral Quiroga2015-09-251-1/+2
| | | | | Reviewed-by: Connor Abbott <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/nir/vec4: Implement nir_intrinsic_load_ssboIago Toral Quiroga2015-09-251-0/+54
| | | | Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/nir/fs: Implement nir_intrinsic_load_ssboIago Toral Quiroga2015-09-251-0/+62
| | | | Reviewed-by: Kristian Høgsberg <[email protected]>
* nir: Implement __intrinsic_load_ssboIago Toral Quiroga2015-09-253-1/+70
| | | | | | | | | | | v2: - Fix ssbo loads with boolean variables. v3: - Simplify the changes (Kristian) Reviewed-by: Connor Abbott <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* nir: modify the instruction insertion in nir_visitor::visit(ir_call *ir)Samuel Iglesias Gonsalvez2015-09-251-4/+10
| | | | | | | | | | | | This patch moves nir_instr_insert_after_cf_list call into each case in the intrinsics switch at nir_visitor::visit(ir_call *ir) and define a nir_dest variable which will be used when handling ir->return_deref after the switch. This patch simplifies the code for nir_intrinsic_load_ssbo implementation changes we are going to do next. Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/nir/vec4: Implement nir_intrinsic_store_ssboIago Toral Quiroga2015-09-251-0/+148
| | | | Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/nir/fs: Implement nir_intrinsic_store_ssboIago Toral Quiroga2015-09-251-0/+71
| | | | Reviewed-by: Kristian Høgsberg <[email protected]>
* nir: Implement __intrinsic_store_ssboIago Toral Quiroga2015-09-252-8/+48
| | | | | | | | v2 (Connor): - Make the STORE() macro take arguments for the extra sources (and their size) and any extra indices required. Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/vec4: Import surface message builder functions.Francisco Jerez2015-09-252-0/+273
| | | | | | | | | | | Implement helper functions that can be used to construct and send untyped and typed surface read, write and atomic messages to the shared dataport unit. v2: Split from the FS implementation. v3: Rewrite to avoid evil array_reg, emit_collect and emit_zip. Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/vec4: Import helpers to convert vectors into arrays and back.Francisco Jerez2015-09-253-0/+130
| | | | | | | | | | | | | These functions handle the conversion of a vec4 into the form expected by the dataport unit in message and message return payloads. The conversion is not always trivial because some messages don't support SIMD4x2 for some generations, in which case a strided copy may be necessary. v2: Split from the FS implementation. v3: Rewrite to avoid evil array_reg, emit_collect and emit_zip. Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/vec4: Introduce VEC4 IR builder.Francisco Jerez2015-09-252-0/+603
| | | | | | | | | | | | See "i965/fs: Introduce FS IR builder." for the rationale. v2: Drop scalarizing VEC4 builder. v3: Take a backend_shader as constructor argument. Improve handling of debug annotations and execution control flags. Rename "instr" variable. Initialize cursor to NULL by default and add method to explicitly point the builder at the end of the program. Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: shader storage blocks use different max block size values than uniformsSamuel Iglesias Gonsalvez2015-09-251-1/+11
| | | | | Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: ignore buffer variables when counting uniform componentsSamuel Iglesias Gonsalvez2015-09-251-5/+11
| | | | | | Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: number of active shader storage blocks must be within allowed limitsSamuel Iglesias Gonsalvez2015-09-251-4/+39
| | | | | | | | | Notice that we should differentiate between shader storage blocks and uniform blocks, since they have different limits. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: a shader storage buffer must be smaller than the maximum size allowedSamuel Iglesias Gonsalvez2015-09-253-1/+21
| | | | | | | | | | | | | | | Otherwise, generate a link time error as per the ARB_shader_storage_buffer_object spec. v2: - Fix error message (Jordan) v3: - Move std140_size() changes to its own patch (Kristian) Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: add std430 interface packing support to ssbo related operationsSamuel Iglesias Gonsalvez2015-09-251-30/+81
| | | | | | | | | | | | | | | | | | | v2: - Get interface packing information from interface's type, not the variable type. - Simplify is_std430 condition in emit_access() for readability (Jordan) - Add a commment explaing why array of three-component vector case is different in std430 than the rest of cases. - Add calls to std430_array_stride(). v3: - Simplify size_mul change for std430's case (Jordan) - Fix commit log lines length (Jordan) - Pass 'packing' instead of 'is_std430' to emit_access() (Kristian) Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: Add std430 support to program_resource_visitor's member functionsSamuel Iglesias Gonsalvez2015-09-253-39/+84
| | | | | | | | | | | | | They are used to calculate the offset, array stride of uniform/shader storage buffer variables. Take into account this info to get the right value for std430. v2: - Fix commit log line length and indention. (Jordan) Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: Add parser/compiler support for std430 interface packing qualifierSamuel Iglesias Gonsalvez2015-09-257-9/+38
| | | | | | | | | | | | | v2: - Fix a missing check in has_layout() v3: - Mention shader storage block in error message for layout qualifiers (Kristian). Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: Add std430 related member functions to glsl_type classSamuel Iglesias Gonsalvez2015-09-252-0/+226
| | | | | | | | | | | | They are used to calculate size, base alignment and array stride values for a glsl_type following std430 rules. v2: - Paste OpenGL 4.3 spec wording as it mentions stride of array. (Jordan) Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: allow default qualifiers for shader storage block definitionsSamuel Iglesias Gonsalvez2015-09-253-3/+70
| | | | | | | | | | | This kind of definitions: layout(xxx) buffer; was not supported by commit 84fc5fece006. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: Move interface block processing to glsl_parser_extras.cppSamuel Iglesias Gonsalvez2015-09-253-126/+128
| | | | | | No functional changes. Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: ignore default qualifier declarations when checking for duplicate ↵Samuel Iglesias Gonsalvez2015-09-253-1/+8
| | | | | | | layout qualifiers Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: layout qualifier can appear more than once since OpenGL 4.20Samuel Iglesias Gonsalvez2015-09-251-2/+8
| | | | | | | Also if GL_ARB_shading_language_420pack extension is enabled. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/wm: surfaces should have the API buffer size, not the drm buffer sizeSamuel Iglesias Gonsalvez2015-09-251-2/+2
| | | | | | | | | | | | | The returned drm buffer object has a size multiple of 4096 but that should not be exposed to the API user, which is working with a different size. As far as I can see this problem is only visible in the calculation of the length of unsized arrays used in SSBOs, as the implementation of this needs to query the underlying buffer size via a message. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/wm: emit null buffer surfaces when null buffers are attachedSamuel Iglesias Gonsalvez2015-09-251-18/+26
| | | | | | | | | | | Otherwise we can expect odd things to happen if, for example, we ask for the size of the attached buffer from shader code, since that might query this value from the surface we uploaded and get random results. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/fs/nir: implement nir_intrinsic_get_buffer_sizeSamuel Iglesias Gonsalvez2015-09-251-0/+24
| | | | | | | | | v2: - Remove inst->regs_written assignment as the instruction only writes to one register. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/fs: Implement FS_OPCODE_GET_BUFFER_SIZESamuel Iglesias Gonsalvez2015-09-255-0/+55
| | | | | Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/vec4/nir: implement nir_intrinsic_get_buffer_sizeSamuel Iglesias Gonsalvez2015-09-251-0/+26
| | | | | Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/vec4: Implement VS_OPCODE_GET_BUFFER_SIZESamuel Iglesias Gonsalvez2015-09-255-0/+44
| | | | | | | | Notice that Skylake needs to include a header in the sampler message so it will need some tweaks to work there. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* nir: Implement ir_unop_get_buffer_sizeSamuel Iglesias Gonsalvez2015-09-252-0/+17
| | | | | | | | This is how backends provide the buffer size required to compute the size of unsized arrays in the previous patch Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: implement unsized array lengthSamuel Iglesias Gonsalvez2015-09-251-0/+182
| | | | | | | | | | | | | | | v2: - Reduce the number of lines over 80 character line width limit. (Thomas Hellan) v3: - Inject the formula to compute the array length in the IR, backends only need to provide the buffer size (Curro) - Create an auxiliary function to simplify code (Jordan Justen) - Rename variables (Jordan Justen) Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: Add parser/compiler support for unsized array's length()Samuel Iglesias Gonsalvez2015-09-259-7/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The unsized array length is computed with the following formula: array.length() = max((buffer_object_size - offset_of_array) / stride_of_array, 0) Of these, only the buffer size needs to be provided by the backends, the frontend already knows the values of the two other variables. This patch identifies the cases where we need to get the length of an unsized array, injecting ir_unop_ssbo_unsized_array_length expressions that will be lowered (in a later patch) to inject the formula mentioned above. It also adds the ir_unop_get_buffer_size expression that drivers will implement to provide the buffer length. v2: - Do not define a triop that will force backends to implement the entire formula, they should only need to provide the buffer size since the other values are known by the frontend (Curro). v3: - Call state->has_shader_storage_buffer_objects() in ast_function.cpp instead of using state->ARB_shader_storage_buffer_object_enable (Tapani). Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: Add unsized array support to glsl_type::std140_size()Samuel Iglesias Gonsalvez2015-09-251-1/+6
| | | | Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: fix indention in glsl_types.cppSamuel Iglesias Gonsalvez2015-09-251-70/+70
| | | | | | | No functional changes. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: add support for unsized arrays in shader storage blocksSamuel Iglesias Gonsalvez2015-09-255-49/+150
| | | | | | | | | | | | | | | | | | | They only can be defined in the last position of the shader storage blocks. When an unsized array is used in different shaders, it might be converted in different sized arrays, avoid get a linker error in that case. v2: - Rework error condition and error messages (Timothy Arceri) v3: - Move OpenGL ES check to its own patch. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: return error if unsized arrays are found in OpenGL ESSamuel Iglesias Gonsalvez2015-09-251-0/+16
| | | | | | Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965/fs: Do not split buffer variablesIago Toral Quiroga2015-09-251-0/+1
| | | | | | | | Buffer variables are the same as uniforms, only that read/write, so we want the same treatment. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965: handle visiting of ir_var_shader_storage variablesIago Toral Quiroga2015-09-251-2/+3
| | | | | Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965: Upload Shader Storage Buffer Object surfacesIago Toral Quiroga2015-09-252-13/+57
| | | | | | | | | | | Since these are a special kind of UBOs we emit them together reusing the same infrastructure, however, we use a RAW surface so we can reuse existing untyped read/write/atomic messages which include a pixel mask header that we need to set to obtain correct behavior with helper invocations of the fragment shader. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965: Set MaxShaderStorageBuffers for compute shadersIago Toral Quiroga2015-09-251-0/+3
| | | | | | | | v2: - Set it after the driver's MaxShaderStorageBuffers value assignment. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965: set ARB_shader_storage_buffer_object related constant valuesSamuel Iglesias Gonsalvez2015-09-251-0/+12
| | | | | | | | | | | | v2: - Add tessellation shader constants assignment v3: - Set MaxShaderStorageBufferBindings to 36. Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965: Implement DriverFlags.NewShaderStorageBufferIago Toral Quiroga2015-09-252-0/+3
| | | | | | | | We use the same dirty state for SSBOs and UBOs because they share the same infrastructure. Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* i965: Use 64-byte offset alignment for shader storage buffersIago Toral Quiroga2015-09-251-0/+9
| | | | | | | | | | | | | | | | | This should be a cacheline (64 bytes) so that we can safely have the CPU and GPU writing the same SSBO on non-cachecoherent systems (our Atom CPUs). With UBOs, the GPU never writes, so there's no problem. For an SSBO, the GPU and the CPU can be updating disjoint regions of the buffer simultaneously and that will break if the regions overlap the same cacheline. v2: - Use cacheline size (64 bytes) instead of 16 bytes (Kristian). - Update commit log and add a comment in the code explaining why we use cacheline size (Ben). Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* mesa: set MAX_SHADER_STORAGE_BUFFERS to 16.Samuel Iglesias Gonsalvez2015-09-251-1/+1
| | | | | | | | | v2: - Set the value to 16 and drop the comment. (Kristian) Signed-off-by: Samuel Iglesias Gonsalvez <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* glsl: add packed varyings to program resource listTapani Pälli2015-09-251-4/+76
| | | | | | | | | | | | | | This makes sure that user is still able to query properties about variables that have gotten packed by lower_packed_varyings pass. Fixes following OpenGL ES 3.1 test: ES31-CTS.program_interface_query.separate-programs-vertex v2: fix 'name included in packed list' check (Ilia Mirkin) v3: iterate over instances of name using strtok_r (Ilia Mirkin) Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Marta Lofstedt <[email protected]>
* mesa: add packed_varyings list to gl_shaderTapani Pälli2015-09-252-4/+13
| | | | | | | | | This is required to store information about packed varyings, currently these variables get lost and cannot be retrieved later in sensible way for program interface queries. List will be utilized by next patch. Signed-off-by: Tapani Pälli <[email protected]> Reviewed-by: Marta Lofstedt <[email protected]>
* i965/cs: Implement DispatchComputeIndirect supportJordan Justen2015-09-243-4/+60
| | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* mesa/cs: Implement glDispatchComputeIndirectJordan Justen2015-09-244-6/+73
| | | | | Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* mesa/cs: Support GL_DISPATCH_INDIRECT_BUFFERJordan Justen2015-09-244-0/+21
| | | | | | | | v2: * Use _mesa_has_compute_shaders (Ilia) Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>
* mesa/cs: Add _mesa_validate_DispatchComputeJordan Justen2015-09-243-23/+53
| | | | | | | | | Move API validation to _mesa_validate_DispatchCompute in api_validate.c. Signed-off-by: Jordan Justen <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Reviewed-by: Kristian Høgsberg <[email protected]>