Commit Graph

69851 Commits

Author SHA1 Message Date
Ian Romanick
6c9c317caf glsl: Add glsl_parser_state::has_atomic_counters helper
v2: Change GL version from 400 to 420.  Noticed by Tapani and Ilia.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
2015-05-04 13:49:58 -07:00
Ian Romanick
fa3475b269 mesa: Use bool in _mesa_is_ helpers instead of GLboolean
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
2015-05-04 13:49:58 -07:00
Ian Romanick
1ec6523fcf mesa: Trivial coding standards cleanups
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
2015-05-04 13:49:57 -07:00
Ian Romanick
5a845cf898 mesa: Use bool instead of GLboolean
v2: Squash in whitespace fixes.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
2015-05-04 13:49:44 -07:00
Ian Romanick
8b103cf636 glsl: Silence unused parameter warnings
I opted to comment out "last_field" because it was not obvious what the
meaning of the dangling bool would be.  For the other parameters, the
meaning was more intuitive without the name.

link_uniform_blocks.cpp:70:65: warning: unused parameter 'name' [-Wunused-parameter]
    virtual void enter_record(const glsl_type *type, const char *name,
                                                                 ^
link_uniform_blocks.cpp:77:65: warning: unused parameter 'name' [-Wunused-parameter]
    virtual void leave_record(const glsl_type *type, const char *name,
                                                                 ^
link_uniform_blocks.cpp:93:62: warning: unused parameter 'record_type' [-Wunused-parameter]
                             bool row_major, const glsl_type *record_type,
                                                              ^
link_uniform_blocks.cpp:94:34: warning: unused parameter 'last_field' [-Wunused-parameter]
                             bool last_field)
                                  ^
link_uniforms.cpp:547:65: warning: unused parameter 'name' [-Wunused-parameter]
    virtual void enter_record(const glsl_type *type, const char *name,
                                                                 ^
link_uniforms.cpp:556:65: warning: unused parameter 'name' [-Wunused-parameter]
    virtual void leave_record(const glsl_type *type, const char *name,
                                                                 ^
link_uniforms.cpp:567:34: warning: unused parameter 'last_field' [-Wunused-parameter]
                             bool last_field)
                                  ^

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
Reviewed-by: Dylan Baker <baker.dylan.c@gmail.com>
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
2015-05-04 13:49:04 -07:00
Ian Romanick
778c7f149a mesa: Restore functionality to dispatch sanity test
Along with a couple secondary goals, the dispatch sanity test had two
major, primary goals.

1. Ensure that all functions part of an API version are set in the
   dispatch table.

2. Ensure that functions that cannot be part of an API version are not
   set in the dispatch table.

Commit 4bdbb58 removed the tests ability to fulfill either of its
primary goals by removing anything that used _mesa_generic_nop().  It
seems like the problem on Windows could have been resolved by adding the
NULL context pointer check from nop_handler to _mesa_generic_nop().
There is, however, some debugging benefit to actually getting the
(supposed) function name logged in the "unsupported function called"
message.

The preceding commit added a function, _glapi_new_nop_table, that
allocates a table of per-entry point no-op functions.  Restore the
ability to actually validate the sanity of the dispatch table by using
_glapi_new_nop_table.

Previous to this commit removing a function from one of the
*_functions_possible lists would not cause the test to fail.  With this
commit removing such a function will result in failure, as is expected.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Brian Paul <brianp@vmware.com>
2015-05-04 13:27:21 -07:00
Francisco Jerez
e1ae0c3bc3 i965: Fix variable indexing of sampler arrays under non-uniform control flow.
ARB_gpu_shader5 requires sampler array indexing expressions to be
dynamically uniform, this however doesn't have any implications on the
control flow that leads to the evaluation of that expression being
uniform.  Use emit_uniformize() to obtain an arbitrary live value from
the binding table index calculation instead of assuming that the first
channel is always live.

Fixes the following Piglit test cases:
  arb_gpu_shader5/execution/sampler_array_indexing/fs-nonuniform-control-flow.shader_test
  arb_gpu_shader5/execution/sampler_array_indexing/vs-nonuniform-control-flow.shader_test

part of the series:
  http://lists.freedesktop.org/archives/piglit/2015-February/014615.html

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:17 +03:00
Francisco Jerez
b234537cc3 i965: Fix variable indexing of UBO arrays under non-uniform control flow.
ARB_gpu_shader5 requires UBO array indexing expressions to be
dynamically uniform, this however doesn't have any implications on the
control flow that leads to the evaluation of that expression being
uniform.  Use emit_uniformize() to obtain an arbitrary live value from
the binding table index calculation instead of assuming that the first
channel is always live.

Fixes the following Piglit tests:
  arb_gpu_shader5/execution/ubo_array_indexing/fs-nonuniform-control-flow.shader_test
  arb_gpu_shader5/execution/ubo_array_indexing/vs-nonuniform-control-flow.shader_test

part of the series:
  http://lists.freedesktop.org/archives/piglit/2015-February/014616.html

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:17 +03:00
Francisco Jerez
046abc998c i965: Define helper function to copy an arbitrary live component from some register.
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:17 +03:00
Francisco Jerez
3da9f708d4 i965: Perform basic optimizations on the FIND_LIVE_CHANNEL opcode.
v2: Save some CPU cycles by doing 'return progress' rather than
    'depth++' in the discard jump special case.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
2015-05-04 17:44:17 +03:00
Francisco Jerez
715bc6d8b1 i965: Introduce the FIND_LIVE_CHANNEL pseudo-opcode.
This instruction calculates the index of an arbitrary channel enabled
in the current execution mask.  It's expected to be used as input for
the BROADCAST opcode, but it's implemented as a separate instruction
rather than being baked into BROADCAST because FIND_LIVE_CHANNEL has
no dependencies so it can always be CSE'ed with other instances of the
same instruction within a basic block.

v2: Whitespace fixes.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:17 +03:00
Francisco Jerez
f2fad0dc80 i965: Perform basic optimizations on the BROADCAST opcode.
v2: Style fixes.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:17 +03:00
Francisco Jerez
c74511f5dc i965: Introduce the BROADCAST pseudo-opcode.
The BROADCAST instruction picks the channel from its first source
given by an index passed in as second source.  This will be used in
situations where all channels from the same SIMD thread have to agree
on the value of something, e.g. a surface binding table index.

This is in particular the case for UBO, sampler and image arrays,
which can be indexed dynamically with the restriction that all active
SIMD channels access the same index, provided to the shared unit as
part of a single scalar field of the message descriptor.  Simply
taking the index value from the first channel as we were doing until
now is incorrect, because it might contain an uninitialized value if
the channel had previously been disabled by non-uniform control flow.

v2: Minor style fixes.  Improve commit message.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:17 +03:00
Francisco Jerez
ce0e151721 glsl: Keep track of the early_fragment_tests flag in gl_shader.
And rename _mesa_glsl_parse_state::early_fragment_tests to
fs_early_fragment_tests for consistency with other FS-specific flags in the
same struct.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:17 +03:00
Francisco Jerez
6c1f6f8291 glsl: Error out on invalid uses of the early_fragment_tests layout qualifier.
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:16 +03:00
Francisco Jerez
b5994d24d8 glsl: Forbid use of image qualifiers in declarations of type other than image.
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:16 +03:00
Francisco Jerez
3f8558650d glsl: Split off memory qualifiers from storage qualifiers.
Image memory qualifiers (coherent, volatile, restrict, readonly and writeonly)
follow slightly different rules from storage qualifiers, e.g. the uniqueness
rule doesn't apply.  Make them a separate non-terminal.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:16 +03:00
Francisco Jerez
f64edfdc44 glsl: Forbid opaque variables as operands of the ternary operator.
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:16 +03:00
Francisco Jerez
b5854ee72b mesa: Update image unit state when glBindImageTexture is called with texture=0.
There's no indication in the spec that the image unit state other than the
bound texture object shouldn't be updated when glBindImageTexture() is called
passing the zero texture as argument.  It's very unlikely that any application
would ever have relied on this, but it's easy to get right, and it fixes the
"state" ARB_shader_image_load_store piglit test.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:16 +03:00
Francisco Jerez
b663d6bc6f mesa: Initialize image units to default state on context creation.
This is the required initial image unit state according to "Table 23.45. Image
State (state per image unit)" of the OpenGL 4.3 specification.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:16 +03:00
Francisco Jerez
1b9990e373 mesa: Implement image uniform queries.
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:16 +03:00
Francisco Jerez
cad0cf4cee mesa: Validate original image internal format rather than derived mesa format.
This matches what _mesa_BindImageTextures() does.  The derived image format
(gl_texture_image::TexFormat) isn't necessarily equivalent to the internal
format of the texture image.  If a forbidden internal format has been
specified we need to mark the image unit as invalid as required by the spec,
regardless of the derived format.  Fixes the "invalid"
ARB_shader_image_load_store piglit test.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:16 +03:00
Francisco Jerez
4e4855f1de mesa: Call _mesa_test_texobj_completeness() before using _MaxLevel in image validation.
gl_texture_object::_MaxLevel doesn't have any meaningful value until
_mesa_test_texobj_completeness() has been run.  Fixes the "level"
ARB_shader_image_load_store piglit test.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:16 +03:00
Francisco Jerez
f74ba58f84 mesa: Add support for binding a buffer texture to a shader image unit.
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:15 +03:00
Francisco Jerez
8424cafbac mesa: Add extern "C" guards to shaderimage.h to allow inclusion from C++ code.
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:15 +03:00
Francisco Jerez
dded5271e4 mesa: Export shader image format to mesa format conversion function.
This function will be useful for back-ends to translate an image internal
format as specified in GLSL code into a mesa format.

Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-05-04 17:44:15 +03:00
Iago Toral Quiroga
96142a3e87 swrast: Fix rgba_draw_pixels with GL_COLOR_INDEX
When we implemented the format conversion rewrite we forgot to handle
GL_COLOR_INDEX here, which needs special handling.

Fixes the following piglit test:
bin/gl-1.0-drawpixels-color-index -auto -fbo

Buzilla: https://bugs.freedesktop.org/show_bug.cgi?id=90213

Tested-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Juha-Pekka Heikkila <juhapekka.heikkila@gmail.com>
Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com>
2015-05-04 16:08:41 +02:00
Francisco Jerez
f1d1d17db6 i965: Add memory fence opcode.
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
2015-05-04 15:05:21 +03:00
Francisco Jerez
f118e5d15f i965: Add typed surface access opcodes.
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
2015-05-04 15:05:21 +03:00
Francisco Jerez
0775d8835a i965: Add untyped surface write opcode.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-05-04 15:05:21 +03:00
Francisco Jerez
c97a7705ea i965: Reorder sources of the untyped atomic opcode.
This is consistent with the untyped surface read opcode.  From now on
all typed and untyped surface access opcodes will follow the same
pattern: src[0] will be the message payload, src[1] will be the
surface index and src[2] will be a control immediate (atomic operation
for atomic opcodes and number of vector components for surface read
and write opcodes).

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-05-04 15:05:20 +03:00
Francisco Jerez
ac747ca5f7 i965: Pass the number of components as a source of the untyped surface read opcode.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-05-04 15:05:20 +03:00
Francisco Jerez
20915130ac i965/vec4: Add support for untyped surface message sends from GRF.
This doesn't actually enable untyped surface message sends from GRF
yet, the upcoming atomic counter and image intrinsic lowering code
will.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-05-04 15:05:20 +03:00
Francisco Jerez
8865fe309d i965: Don't request untyped atomic writeback message if the destination is null.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-05-04 15:05:20 +03:00
Francisco Jerez
0519a6259b i965: Simplify generator code for untyped surface messages.
The generate_untyped_*() methods do nothing useful other than calling
the corresponding function from brw_eu_emit.c.  The calls to
brw_mark_surface_used() will go away too in a future commit.

Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
Acked-by: Kenneth Graunke <kenneth@whitecape.org>
2015-05-04 15:05:20 +03:00
Francisco Jerez
2f1c16df3e i965: Fix the untyped surface opcodes to deal with indirect surface access.
Change brw_untyped_atomic() and brw_untyped_surface_read() to take the
surface index as a register instead of a constant and to use
brw_send_indirect_message() to emit the indirect variant of send with
a dynamically calculated message descriptor.  This will be required to
support variable indexing of image arrays for
ARB_shader_image_load_store.

Acked-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
2015-05-04 15:05:20 +03:00
Chia-I Wu
4348046a2f ilo: use ilo_image exclusively in core
Initialize ilo_view_surface and ilo_zs_surface from ilo_image instead of
ilo_texture.
2015-05-02 22:28:31 +08:00
Chia-I Wu
9b705ec32d ilo: add ilo_image_can_enable_aux()
It replaces ilo_texture_can_enable_hiz().
2015-05-02 22:14:07 +08:00
Chia-I Wu
430594c34f ilo: make ilo_image more self-contained
Add depth0, sample_count, and scanout to ilo_image.
2015-05-02 22:14:06 +08:00
Chia-I Wu
f6ca4084c7 ilo: add ilo_image_init_for_imported()
It replaces ilo_image_update_for_imported_bo() and enables more error
checkings for imported textures.
2015-05-02 22:14:06 +08:00
Chia-I Wu
938c9b8cea ilo: prepare for image init for imported bo
Refactoring in prepraration for ilo_image_init_for_imported().
2015-05-02 22:14:06 +08:00
Chia-I Wu
3f9415077b ilo: constify ilo_image_params
Make ilo_image_params const in functions that do not modify it.
2015-05-02 22:14:06 +08:00
Chia-I Wu
c209aa7a8f ilo: improve readability of ilo_image
Improve docs, rename struct fields, and reorder walk types.  No real changes.
2015-05-02 22:14:06 +08:00
Chia-I Wu
9b72bf5bd2 ilo: move command builder to core 2015-05-02 22:14:06 +08:00
Chia-I Wu
9e24c49e64 ilo: move ilo_state_3d* to core
ilo state structs (struct ilo_xxx_state) are moved as well.
2015-05-02 22:14:06 +08:00
Chia-I Wu
8ab18262c5 ilo: add ilo_buffer.h to core
Rename the original ilo_buffer to ilo_buffer_resource to avoid name conflict.
2015-05-02 22:14:06 +08:00
Chia-I Wu
3afbeb115a ilo: move BOs from ilo_texture to ilo_image
We want to work with ilo_image instead of ilo_texture in core.
2015-05-02 22:14:06 +08:00
Chia-I Wu
ac47563cb4 ilo: move ilo_layout.[ch] to core as ilo_image.[ch]
Move files and s/layout/image/.
2015-05-02 22:14:06 +08:00
Chia-I Wu
8252765532 ilo: add ilo_format.[ch] to core
The original ilo_format.[ch] are removed.
2015-05-02 22:14:06 +08:00
Chia-I Wu
9b7080c8b3 ilo: add ilo_fence.h to core
Implement pipe_fence_handle on top of ilo_fence.
2015-05-02 22:14:06 +08:00