mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-05 22:00:11 +01:00
Merge remote-tracking branch 'public/master' into vulkan
This commit is contained in:
commit
12f88ba32a
310 changed files with 5116 additions and 2936 deletions
|
|
@ -91,7 +91,6 @@ SUBDIRS := \
|
|||
src/loader \
|
||||
src/mapi \
|
||||
src/compiler \
|
||||
src/compiler/glsl \
|
||||
src/mesa \
|
||||
src/util \
|
||||
src/egl \
|
||||
|
|
|
|||
|
|
@ -97,6 +97,7 @@ def AddOptions(opts):
|
|||
opts.Add(BoolOption('embedded', 'embedded build', 'no'))
|
||||
opts.Add(BoolOption('analyze',
|
||||
'enable static code analysis where available', 'no'))
|
||||
opts.Add(BoolOption('asan', 'enable Address Sanitizer', 'no'))
|
||||
opts.Add('toolchain', 'compiler toolchain', default_toolchain)
|
||||
opts.Add(BoolOption('gles', 'EXPERIMENTAL: enable OpenGL ES support',
|
||||
'no'))
|
||||
|
|
|
|||
|
|
@ -110,10 +110,10 @@ LT_INIT([disable-static])
|
|||
AC_CHECK_PROG(RM, rm, [rm -f])
|
||||
|
||||
AX_PROG_BISON([],
|
||||
AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-parse.c"],
|
||||
AS_IF([test ! -f "$srcdir/src/compiler/glsl/glcpp/glcpp-parse.c"],
|
||||
[AC_MSG_ERROR([bison not found - unable to compile glcpp-parse.y])]))
|
||||
AX_PROG_FLEX([],
|
||||
AS_IF([test ! -f "$srcdir/src/glsl/glcpp/glcpp-lex.c"],
|
||||
AS_IF([test ! -f "$srcdir/src/compiler/glsl/glcpp/glcpp-lex.c"],
|
||||
[AC_MSG_ERROR([flex not found - unable to compile glcpp-lex.l])]))
|
||||
|
||||
AC_CHECK_PROG(INDENT, indent, indent, cat)
|
||||
|
|
|
|||
24
docs/GL3.txt
24
docs/GL3.txt
|
|
@ -146,11 +146,11 @@ GL 4.1, GLSL 4.10 --- all DONE: nvc0, r600, radeonsi
|
|||
GL_ARB_viewport_array DONE (i965, nv50, llvmpipe, softpipe)
|
||||
|
||||
|
||||
GL 4.2, GLSL 4.20:
|
||||
GL 4.2, GLSL 4.20 -- all DONE: radeonsi
|
||||
|
||||
GL_ARB_texture_compression_bptc DONE (i965, nvc0, r600, radeonsi)
|
||||
GL_ARB_compressed_texture_pixel_storage DONE (all drivers)
|
||||
GL_ARB_shader_atomic_counters DONE (i965, nvc0)
|
||||
GL_ARB_shader_atomic_counters DONE (i965, nvc0, radeonsi, softpipe)
|
||||
GL_ARB_texture_storage DONE (all drivers)
|
||||
GL_ARB_transform_feedback_instanced DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe)
|
||||
GL_ARB_base_instance DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe)
|
||||
|
|
@ -172,14 +172,14 @@ GL 4.3, GLSL 4.30:
|
|||
GL_KHR_debug DONE (all drivers)
|
||||
GL_ARB_explicit_uniform_location DONE (all drivers that support GLSL)
|
||||
GL_ARB_fragment_layer_viewport DONE (i965, nv50, nvc0, r600, radeonsi, llvmpipe)
|
||||
GL_ARB_framebuffer_no_attachments DONE (i965, r600, radeonsi)
|
||||
GL_ARB_framebuffer_no_attachments DONE (i965, nvc0, r600, radeonsi, softpipe)
|
||||
GL_ARB_internalformat_query2 DONE (all drivers)
|
||||
GL_ARB_invalidate_subdata DONE (all drivers)
|
||||
GL_ARB_multi_draw_indirect DONE (i965, nvc0, r600, radeonsi, llvmpipe, softpipe)
|
||||
GL_ARB_program_interface_query DONE (all drivers)
|
||||
GL_ARB_robust_buffer_access_behavior not started
|
||||
GL_ARB_shader_image_size DONE (i965, radeonsi)
|
||||
GL_ARB_shader_storage_buffer_object DONE (i965, nvc0)
|
||||
GL_ARB_robust_buffer_access_behavior DONE (radeonsi)
|
||||
GL_ARB_shader_image_size DONE (i965, radeonsi, softpipe)
|
||||
GL_ARB_shader_storage_buffer_object DONE (i965, nvc0, radeonsi, softpipe)
|
||||
GL_ARB_stencil_texturing DONE (i965/gen8+, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe)
|
||||
GL_ARB_texture_buffer_range DONE (nv50, nvc0, i965, r600, radeonsi, llvmpipe)
|
||||
GL_ARB_texture_query_levels DONE (all drivers that support GLSL 1.30)
|
||||
|
|
@ -228,12 +228,12 @@ GLES3.1, GLSL ES 3.1
|
|||
GL_ARB_compute_shader DONE (i965)
|
||||
GL_ARB_draw_indirect DONE (i965, nvc0, r600, radeonsi, llvmpipe, softpipe)
|
||||
GL_ARB_explicit_uniform_location DONE (all drivers that support GLSL)
|
||||
GL_ARB_framebuffer_no_attachments DONE (i965)
|
||||
GL_ARB_framebuffer_no_attachments DONE (i965, nvc0, r600, radeonsi, softpipe)
|
||||
GL_ARB_program_interface_query DONE (all drivers)
|
||||
GL_ARB_shader_atomic_counters DONE (i965, nvc0)
|
||||
GL_ARB_shader_image_load_store DONE (i965)
|
||||
GL_ARB_shader_image_size DONE (i965)
|
||||
GL_ARB_shader_storage_buffer_object DONE (i965, nvc0)
|
||||
GL_ARB_shader_atomic_counters DONE (i965, nvc0, radeonsi, softpipe)
|
||||
GL_ARB_shader_image_load_store DONE (i965, softpipe, radeonsi)
|
||||
GL_ARB_shader_image_size DONE (i965, softpipe, radeonsi)
|
||||
GL_ARB_shader_storage_buffer_object DONE (i965, nvc0, radeonsi, softpipe)
|
||||
GL_ARB_shading_language_packing DONE (all drivers)
|
||||
GL_ARB_separate_shader_objects DONE (all drivers)
|
||||
GL_ARB_stencil_texturing DONE (i965/gen8+, nv50, nvc0, r600, radeonsi, llvmpipe, softpipe)
|
||||
|
|
@ -269,7 +269,7 @@ GLES3.2, GLSL ES 3.2
|
|||
GL_OES_shader_multisample_interpolation DONE (nvc0, r600, radeonsi)
|
||||
GL_OES_tessellation_shader not started (based on GL_ARB_tessellation_shader, which is done for some drivers)
|
||||
GL_OES_texture_border_clamp DONE (all drivers)
|
||||
GL_OES_texture_buffer DONE (core only)
|
||||
GL_OES_texture_buffer DONE (i965, radeonsi)
|
||||
GL_OES_texture_cube_map_array not started (based on GL_ARB_texture_cube_map_array, which is done for all drivers)
|
||||
GL_OES_texture_stencil8 DONE (all drivers that support GL_ARB_texture_stencil8)
|
||||
GL_OES_texture_storage_multisample_2d_array DONE (all drivers that support GL_ARB_texture_multisample)
|
||||
|
|
|
|||
|
|
@ -22,11 +22,11 @@ People who are concerned with stability and reliability should stick
|
|||
with a previous release or wait for Mesa 11.3.1.
|
||||
</p>
|
||||
<p>
|
||||
Mesa 11.3.0 implements the OpenGL 4.1 API, but the version reported by
|
||||
Mesa 11.3.0 implements the OpenGL 4.2 API, but the version reported by
|
||||
glGetString(GL_VERSION) or glGetIntegerv(GL_MAJOR_VERSION) /
|
||||
glGetIntegerv(GL_MINOR_VERSION) depends on the particular driver being used.
|
||||
Some drivers don't support all the features required in OpenGL 4.1. OpenGL
|
||||
4.1 is <strong>only</strong> available if requested at context creation
|
||||
Some drivers don't support all the features required in OpenGL 4.2. OpenGL
|
||||
4.2 is <strong>only</strong> available if requested at context creation
|
||||
because compatibility contexts are not supported.
|
||||
</p>
|
||||
|
||||
|
|
@ -44,16 +44,21 @@ Note: some of the new features are only available with certain drivers.
|
|||
</p>
|
||||
|
||||
<ul>
|
||||
<li>GL_ARB_framebuffer_no_attachments on r600, radeonsi</li>
|
||||
<li>OpenGL 4.2 on radeonsi</li>
|
||||
<li>GL_ARB_framebuffer_no_attachments on nvc0, r600, radeonsi, softpipe</li>
|
||||
<li>GL_ARB_internalformat_query2 on all drivers</li>
|
||||
<li>GL_ARB_shader_atomic_counter_ops on nvc0</li>
|
||||
<li>GL_ARB_robust_buffer_access_behavior on radeonsi</li>
|
||||
<li>GL_ARB_shader_atomic_counters on radeonsi, softpipe</li>
|
||||
<li>GL_ARB_shader_atomic_counter_ops on nvc0, radeonsi, softpipe</li>
|
||||
<li>GL_ARB_shader_image_load_store on radeonsi, softpipe</li>
|
||||
<li>GL_ARB_shader_image_size on radeonsi</li>
|
||||
<li>GL_ARB_shader_image_size on radeonsi, softpipe</li>
|
||||
<li>GL_ARB_shader_storage_buffer_objects on radeonsi, softpipe</li>
|
||||
<li>GL_ATI_fragment_shader on all Gallium drivers</li>
|
||||
<li>GL_EXT_base_instance on all drivers that support GL_ARB_base_instance</li>
|
||||
<li>GL_OES_draw_buffers_indexed and GL_EXT_draw_buffers_indexed on all drivers that support GL_ARB_draw_buffers_blend</li>
|
||||
<li>GL_OES_shader_image_atomic on all drivers that support GL_ARB_shader_image_load_store</li>
|
||||
<li>GL_OES_texture_border_clamp and GL_EXT_texture_border_clamp on all drivers that support GL_ARB_texture_border_clamp</li>
|
||||
<li>GL_OES_texture_buffer and GL_EXT_texture_buffer on i965, radeonsi</li>
|
||||
<li>EGL_KHR_reusable_sync on all drivers</li>
|
||||
</ul>
|
||||
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
<dd>is a very useful tool for tracking down
|
||||
memory-related problems in your code.</dd>
|
||||
|
||||
<dt><a href="http:scan.coverity.com/projects/mesa">Coverity</a><dt>
|
||||
<dt><a href="http://scan.coverity.com/projects/mesa">Coverity</a><dt>
|
||||
<dd>provides static code analysis of Mesa. If you create an account
|
||||
you can see the results and try to fix outstanding issues.</dd>
|
||||
</dl>
|
||||
|
|
|
|||
8
doxygen/.gitignore
vendored
8
doxygen/.gitignore
vendored
|
|
@ -1,9 +1,6 @@
|
|||
*.db
|
||||
*.tag
|
||||
*.tmp
|
||||
agpgart
|
||||
array_cache
|
||||
core
|
||||
core_subset
|
||||
gallium
|
||||
gbm
|
||||
|
|
@ -13,11 +10,8 @@ i965
|
|||
main
|
||||
math
|
||||
math_subset
|
||||
miniglx
|
||||
radeondrm
|
||||
radeonfb
|
||||
nir
|
||||
radeon_subset
|
||||
shader
|
||||
swrast
|
||||
swrast_setup
|
||||
tnl
|
||||
|
|
|
|||
|
|
@ -12,13 +12,13 @@ FULL = \
|
|||
vbo.doxy \
|
||||
glapi.doxy \
|
||||
glsl.doxy \
|
||||
shader.doxy \
|
||||
swrast.doxy \
|
||||
swrast_setup.doxy \
|
||||
tnl.doxy \
|
||||
tnl_dd.doxy \
|
||||
gbm.doxy \
|
||||
i965.doxy
|
||||
i965.doxy \
|
||||
nir.doxy
|
||||
|
||||
full: $(FULL:.doxy=.tag)
|
||||
$(foreach FILE,$(FULL),doxygen $(FILE);)
|
||||
|
|
|
|||
35
doxygen/Makefile.orig
Normal file
35
doxygen/Makefile.orig
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
|
||||
default: full
|
||||
|
||||
all: full subset
|
||||
|
||||
%.tag: %.doxy
|
||||
doxygen $<
|
||||
|
||||
FULL = \
|
||||
main.doxy \
|
||||
math.doxy \
|
||||
vbo.doxy \
|
||||
glapi.doxy \
|
||||
glsl.doxy \
|
||||
swrast.doxy \
|
||||
swrast_setup.doxy \
|
||||
tnl.doxy \
|
||||
tnl_dd.doxy \
|
||||
gbm.doxy \
|
||||
i965.doxy
|
||||
|
||||
full: $(FULL:.doxy=.tag)
|
||||
$(foreach FILE,$(FULL),doxygen $(FILE);)
|
||||
|
||||
SUBSET = \
|
||||
main.doxy \
|
||||
math.doxy
|
||||
|
||||
subset: $(SUBSET:.doxy=.tag)
|
||||
$(foreach FILE,$(SUBSET),doxygen $(FILE);)
|
||||
|
||||
clean:
|
||||
-rm -rf $(FULL:.doxy=) $(SUBSET:.doxy=)
|
||||
-rm -rf *.tag
|
||||
-rm -rf *.db
|
||||
|
|
@ -53,16 +53,6 @@ CREATE_SUBDIRS = NO
|
|||
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
||||
# This tag can be used to specify the encoding used in the generated output.
|
||||
# The encoding is not always determined by the language that is chosen,
|
||||
# but also whether or not the output is meant for Windows or non-Windows users.
|
||||
# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
|
||||
# forces the Windows encoding (this is the default for the Windows binary),
|
||||
# whereas setting the tag to NO uses a Unix-style encoding (the default for
|
||||
# all platforms other than Windows).
|
||||
|
||||
USE_WINDOWS_ENCODING = NO
|
||||
|
||||
# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
|
||||
# include brief member descriptions after the members that are listed in
|
||||
# the file and class documentation (similar to JavaDoc).
|
||||
|
|
@ -147,13 +137,6 @@ JAVADOC_AUTOBRIEF = YES
|
|||
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
|
||||
# If the DETAILS_AT_TOP tag is set to YES then Doxygen
|
||||
# will output the detailed description near the top, like JavaDoc.
|
||||
# If set to NO, the detailed description appears after the member
|
||||
# documentation.
|
||||
|
||||
DETAILS_AT_TOP = YES
|
||||
|
||||
# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
|
||||
# member inherits the documentation from any documented member that it
|
||||
# re-implements.
|
||||
|
|
@ -607,12 +590,6 @@ HTML_FOOTER =
|
|||
|
||||
HTML_STYLESHEET =
|
||||
|
||||
# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
|
||||
# files or namespaces will be aligned in HTML using tables. If set to
|
||||
# NO a bullet list will be used.
|
||||
|
||||
HTML_ALIGN_MEMBERS = YES
|
||||
|
||||
# If the GENERATE_HTMLHELP tag is set to YES, additional index files
|
||||
# will be generated that can be used as input for tools like the
|
||||
# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
|
||||
|
|
@ -839,18 +816,6 @@ GENERATE_XML = NO
|
|||
|
||||
XML_OUTPUT = xml
|
||||
|
||||
# The XML_SCHEMA tag can be used to specify an XML schema,
|
||||
# which can be used by a validating XML parser to check the
|
||||
# syntax of the XML files.
|
||||
|
||||
XML_SCHEMA =
|
||||
|
||||
# The XML_DTD tag can be used to specify an XML DTD,
|
||||
# which can be used by a validating XML parser to check the
|
||||
# syntax of the XML files.
|
||||
|
||||
XML_DTD =
|
||||
|
||||
# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
|
||||
# dump the program listings (including syntax highlighting
|
||||
# and cross-referencing information) to the XML output. Note that
|
||||
|
|
@ -1104,22 +1069,6 @@ DOT_PATH =
|
|||
|
||||
DOTFILE_DIRS =
|
||||
|
||||
# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
|
||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
||||
# the specified constraint. Beware that most browsers cannot cope with very
|
||||
# large images.
|
||||
|
||||
MAX_DOT_GRAPH_WIDTH = 1024
|
||||
|
||||
# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
|
||||
# (in pixels) of the graphs generated by dot. If a graph becomes larger than
|
||||
# this value, doxygen will try to truncate the graph, so that it fits within
|
||||
# the specified constraint. Beware that most browsers cannot cope with very
|
||||
# large images.
|
||||
|
||||
MAX_DOT_GRAPH_HEIGHT = 1024
|
||||
|
||||
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
|
||||
# graphs generated by dot. A depth value of 3 means that only nodes reachable
|
||||
# from the root by following a path via at most 3 edges will be shown. Nodes that
|
||||
|
|
|
|||
|
|
@ -190,8 +190,7 @@ SKIP_FUNCTION_MACROS = YES
|
|||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = \
|
||||
math_subset.tag=../math_subset \
|
||||
miniglx.tag=../miniglx
|
||||
math_subset.tag=../math_subset
|
||||
GENERATE_TAGFILE = core_subset.tag
|
||||
ALLEXTERNALS = NO
|
||||
PERL_PATH =
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ doxygen swrast_setup.doxy
|
|||
doxygen tnl.doxy
|
||||
doxygen core.doxy
|
||||
doxygen glapi.doxy
|
||||
doxygen shader.doxy
|
||||
|
||||
echo Building again, to resolve tags
|
||||
doxygen tnl_dd.doxy
|
||||
|
|
@ -16,4 +15,3 @@ doxygen swrast.doxy
|
|||
doxygen swrast_setup.doxy
|
||||
doxygen tnl.doxy
|
||||
doxygen glapi.doxy
|
||||
doxygen shader.doxy
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ SKIP_FUNCTION_MACROS = YES
|
|||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = main.tag=../core \
|
||||
TAGFILES = main.tag=../main \
|
||||
math.tag=../math \
|
||||
tnl_dd.tag=../tnl_dd \
|
||||
swrast_setup.tag=../gbm_setup \
|
||||
swrast_setup.tag=../swrast_setup \
|
||||
tnl.tag=../tnl \
|
||||
vbo.tag=vbo
|
||||
vbo.tag=../vbo
|
||||
GENERATE_TAGFILE = gbm.tag
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ PROJECT_NAME = "Mesa GL API dispatcher"
|
|||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ../src/mesa/glapi/
|
||||
INPUT = ../src/mapi/glapi/
|
||||
FILE_PATTERNS = *.c *.h
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
|
|
@ -39,11 +39,11 @@ SKIP_FUNCTION_MACROS = YES
|
|||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = main.tag=../core \
|
||||
TAGFILES = main.tag=../main \
|
||||
math.tag=../math \
|
||||
tnl_dd.tag=../tnl_dd \
|
||||
swrast.tag=../swrast \
|
||||
swrast_setup.tag=../swrast_setup \
|
||||
tnl.tag=../tnl \
|
||||
vbo.tag=vbo
|
||||
GENERATE_TAGFILE = swrast.tag
|
||||
vbo.tag=../vbo
|
||||
GENERATE_TAGFILE = glapi.tag
|
||||
|
|
|
|||
|
|
@ -9,11 +9,12 @@ PROJECT_NAME = "Mesa GLSL module"
|
|||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ../src/glsl/
|
||||
INPUT = ../src/compiler/glsl/
|
||||
FILE_PATTERNS = *.c *.cpp *.h
|
||||
RECURSIVE = NO
|
||||
EXCLUDE = ../src/glsl/glsl_lexer.cpp \
|
||||
../src/glsl/glsl_parser.cpp \
|
||||
../src/glsl/glsl_parser.h
|
||||
EXCLUDE = ../src/compiler/glsl/glsl_lexer.cpp \
|
||||
../src/compiler/glsl/glsl_parser.cpp \
|
||||
../src/compiler/glsl/glsl_parser.h
|
||||
EXCLUDE_PATTERNS =
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
<a class="qindex" href="../main/index.html">core</a> |
|
||||
<a class="qindex" href="../glapi/index.html">glapi</a> |
|
||||
<a class="qindex" href="../glsl/index.html">glsl</a> |
|
||||
<a class="qindex" href="../nir/index.html">nir</a> |
|
||||
<a class="qindex" href="../vbo/index.html">vbo</a> |
|
||||
<a class="qindex" href="../math/index.html">math</a> |
|
||||
<a class="qindex" href="../shader/index.html">shader</a> |
|
||||
<a class="qindex" href="../swrast/index.html">swrast</a> |
|
||||
<a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> |
|
||||
<a class="qindex" href="../tnl/index.html">tnl</a> |
|
||||
|
|
|
|||
19
doxygen/header.html.orig
Normal file
19
doxygen/header.html.orig
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Mesa Source Code Documentation</title>
|
||||
<link href="doxygen.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="qindex">
|
||||
<a class="qindex" href="../main/index.html">core</a> |
|
||||
<a class="qindex" href="../glapi/index.html">glapi</a> |
|
||||
<a class="qindex" href="../glsl/index.html">glsl</a> |
|
||||
<a class="qindex" href="../vbo/index.html">vbo</a> |
|
||||
<a class="qindex" href="../math/index.html">math</a> |
|
||||
<a class="qindex" href="../swrast/index.html">swrast</a> |
|
||||
<a class="qindex" href="../swrast_setup/index.html">swrast_setup</a> |
|
||||
<a class="qindex" href="../tnl/index.html">tnl</a> |
|
||||
<a class="qindex" href="../tnl_dd/index.html">tnl_dd</a> |
|
||||
<a class="qindex" href="../gbm/index.html">gbm</a> |
|
||||
<a class="qindex" href="../i965/index.html">i965</a>
|
||||
</div>
|
||||
|
|
@ -6,6 +6,5 @@
|
|||
<div class="qindex">
|
||||
<a class="qindex" href="../core_subset/index.html">Mesa Core</a> |
|
||||
<a class="qindex" href="../math_subset/index.html">math</a> |
|
||||
<a class="qindex" href="../miniglx/index.html">MiniGLX</a> |
|
||||
<a class="qindex" href="../radeon_subset/index.html">radeon_subset</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -46,5 +46,5 @@ TAGFILES = glsl.tag=../glsl \
|
|||
swrast_setup.tag=../swrast_setup \
|
||||
tnl.tag=../tnl \
|
||||
tnl_dd.tag=../tnl_dd \
|
||||
vbo.tag=vbo
|
||||
vbo.tag=../vbo
|
||||
GENERATE_TAGFILE = i965.tag
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ TAGFILES = tnl_dd.tag=../tnl_dd \
|
|||
vbo.tag=../vbo \
|
||||
glapi.tag=../glapi \
|
||||
math.tag=../math \
|
||||
shader.tag=../shader \
|
||||
swrast.tag=../swrast \
|
||||
swrast_setup.tag=../swrast_setup \
|
||||
tnl.tag=../tnl
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ SKIP_FUNCTION_MACROS = YES
|
|||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = tnl_dd.tag=../tnl_dd \
|
||||
main.tag=../core \
|
||||
main.tag=../main \
|
||||
swrast.tag=../swrast \
|
||||
swrast_setup.tag=../swrast_setup \
|
||||
tnl.tag=../tnl \
|
||||
|
|
|
|||
|
|
@ -5,45 +5,46 @@
|
|||
#---------------------------------------------------------------------------
|
||||
# General configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = "Mesa Vertex and Fragment Program code"
|
||||
PROJECT_NAME = "Mesa NIR module"
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the input files
|
||||
# Configuration options related to the input files
|
||||
#---------------------------------------------------------------------------
|
||||
INPUT = ../src/mesa/shader/
|
||||
FILE_PATTERNS = *.c *.h
|
||||
INPUT = ../src/compiler/nir
|
||||
FILE_PATTERNS = *.c *.cpp *.h
|
||||
RECURSIVE = NO
|
||||
EXCLUDE =
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXCLUDE =
|
||||
EXCLUDE_PATTERNS =
|
||||
EXAMPLE_PATH =
|
||||
EXAMPLE_PATTERNS =
|
||||
EXAMPLE_RECURSIVE = NO
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
IMAGE_PATH =
|
||||
INPUT_FILTER =
|
||||
FILTER_SOURCE_FILES = NO
|
||||
#---------------------------------------------------------------------------
|
||||
# configuration options related to the HTML output
|
||||
# Configuration options related to the HTML output
|
||||
#---------------------------------------------------------------------------
|
||||
HTML_OUTPUT = shader
|
||||
HTML_OUTPUT = nir
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration options related to the preprocessor
|
||||
# Configuration options related to the preprocessor
|
||||
#---------------------------------------------------------------------------
|
||||
ENABLE_PREPROCESSING = YES
|
||||
MACRO_EXPANSION = NO
|
||||
EXPAND_ONLY_PREDEF = NO
|
||||
SEARCH_INCLUDES = YES
|
||||
INCLUDE_PATH = ../include/
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
INCLUDE_FILE_PATTERNS =
|
||||
PREDEFINED =
|
||||
EXPAND_AS_DEFINED =
|
||||
SKIP_FUNCTION_MACROS = YES
|
||||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
# Configuration::additions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = main.tag=../core \
|
||||
TAGFILES = glsl.tag=../glsl \
|
||||
main.tag=../main \
|
||||
math.tag=../math \
|
||||
tnl_dd.tag=../tnl_dd \
|
||||
swrast.tag=../swrast \
|
||||
swrast_setup.tag=../swrast_setup \
|
||||
tnl.tag=../tnl \
|
||||
vbo.tag=vbo
|
||||
GENERATE_TAGFILE = swrast.tag
|
||||
tnl_dd.tag=../tnl_dd \
|
||||
vbo.tag=../vbo
|
||||
GENERATE_TAGFILE = nir.tag
|
||||
|
|
@ -168,8 +168,7 @@ SKIP_FUNCTION_MACROS = YES
|
|||
#---------------------------------------------------------------------------
|
||||
TAGFILES = \
|
||||
core_subset.tag=../core_subset \
|
||||
math_subset.tag=../math_subset \
|
||||
miniglx.tag=../miniglx
|
||||
math_subset.tag=../math_subset
|
||||
GENERATE_TAGFILE = radeon_subset.tag
|
||||
ALLEXTERNALS = NO
|
||||
PERL_PATH =
|
||||
|
|
|
|||
|
|
@ -39,10 +39,10 @@ SKIP_FUNCTION_MACROS = YES
|
|||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = main.tag=../core \
|
||||
TAGFILES = main.tag=../main \
|
||||
math.tag=../math \
|
||||
tnl_dd.tag=../tnl_dd \
|
||||
swrast_setup.tag=../swrast_setup \
|
||||
tnl.tag=../tnl \
|
||||
vbo.tag=vbo
|
||||
vbo.tag=../vbo
|
||||
GENERATE_TAGFILE = swrast.tag
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ SKIP_FUNCTION_MACROS = YES
|
|||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = tnl_dd.tag=../tnl_dd \
|
||||
main.tag=../core \
|
||||
main.tag=../main \
|
||||
math.tag=../math \
|
||||
swrast.tag=../swrast \
|
||||
tnl.tag=../tnl \
|
||||
|
|
|
|||
|
|
@ -40,11 +40,10 @@ SKIP_FUNCTION_MACROS = YES
|
|||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = tnl_dd.tag=../tnl \
|
||||
main.tag=../core \
|
||||
TAGFILES = tnl_dd.tag=../tnl_dd \
|
||||
main.tag=../main \
|
||||
math.tag=../math \
|
||||
shader.tag=../shader \
|
||||
swrast.tag=../swrast \
|
||||
swrast_setup.tag=swrast_setup \
|
||||
vbo.tag=vbo
|
||||
swrast_setup.tag=../swrast_setup \
|
||||
vbo.tag=../vbo
|
||||
GENERATE_TAGFILE = tnl.tag
|
||||
|
|
|
|||
|
|
@ -39,11 +39,10 @@ SKIP_FUNCTION_MACROS = YES
|
|||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = main.tag=../core \
|
||||
TAGFILES = main.tag=../main \
|
||||
math.tag=../math \
|
||||
shader.tag=../shader \
|
||||
swrast.tag=../swrast \
|
||||
swrast_setup.tag=../swrast_setup \
|
||||
tnl.tag=../tnl \
|
||||
vbo.tag=vbo
|
||||
vbo.tag=../vbo
|
||||
GENERATE_TAGFILE = tnl_dd.tag
|
||||
|
|
|
|||
|
|
@ -40,9 +40,8 @@ SKIP_FUNCTION_MACROS = YES
|
|||
#---------------------------------------------------------------------------
|
||||
# Configuration::addtions related to external references
|
||||
#---------------------------------------------------------------------------
|
||||
TAGFILES = main.tag=../core \
|
||||
TAGFILES = main.tag=../main \
|
||||
math.tag=../math \
|
||||
shader.tag=../shader \
|
||||
swrast.tag=../swrast \
|
||||
swrast_setup.tag=../swrast_setup \
|
||||
tnl.tag=../tnl \
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ def generate(env):
|
|||
# Work around aliasing bugs - developers should comment this out
|
||||
ccflags += ['-fno-strict-aliasing']
|
||||
ccflags += ['-g']
|
||||
if env['build'] in ('checked', 'profile'):
|
||||
if env['build'] in ('checked', 'profile') or env['asan']:
|
||||
# See http://code.google.com/p/jrfonseca/wiki/Gprof2Dot#Which_options_should_I_pass_to_gcc_when_compiling_for_profiling?
|
||||
ccflags += [
|
||||
'-fno-omit-frame-pointer',
|
||||
|
|
@ -540,6 +540,16 @@ def generate(env):
|
|||
# scan-build will produce more comprehensive output
|
||||
env.Append(CCFLAGS = ['--analyze'])
|
||||
|
||||
# https://github.com/google/sanitizers/wiki/AddressSanitizer
|
||||
if env['asan']:
|
||||
if gcc_compat:
|
||||
env.Append(CCFLAGS = [
|
||||
'-fsanitize=address',
|
||||
])
|
||||
env.Append(LINKFLAGS = [
|
||||
'-fsanitize=address',
|
||||
])
|
||||
|
||||
# Assembler options
|
||||
if gcc_compat:
|
||||
if env['machine'] == 'x86':
|
||||
|
|
|
|||
|
|
@ -32,8 +32,9 @@ intermediates := $(call local-generated-sources-dir)
|
|||
LOCAL_SRC_FILES := $(LOCAL_SRC_FILES)
|
||||
|
||||
LOCAL_C_INCLUDES += \
|
||||
$(intermediates)/glcpp \
|
||||
$(LOCAL_PATH)/glcpp \
|
||||
$(intermediates)/glsl \
|
||||
$(LOCAL_PATH)/glsl \
|
||||
$(LOCAL_PATH)/glsl/glcpp \
|
||||
|
||||
LOCAL_GENERATED_SOURCES += $(addprefix $(intermediates)/, \
|
||||
$(LIBGLCPP_GENERATED_FILES) \
|
||||
|
|
@ -65,14 +66,14 @@ define local-yy-to-cpp-and-h
|
|||
rm -f $(@:$1=$(YACC_HEADER_SUFFIX))
|
||||
endef
|
||||
|
||||
$(intermediates)/glsl_lexer.cpp: $(LOCAL_PATH)/glsl_lexer.ll
|
||||
$(intermediates)/glsl/glsl_lexer.cpp: $(LOCAL_PATH)/glsl/glsl_lexer.ll
|
||||
$(call local-l-or-ll-to-c-or-cpp)
|
||||
|
||||
$(intermediates)/glsl_parser.cpp: $(LOCAL_PATH)/glsl_parser.yy
|
||||
$(intermediates)/glsl/glsl_parser.cpp: $(LOCAL_PATH)/glsl/glsl_parser.yy
|
||||
$(call local-yy-to-cpp-and-h,.cpp)
|
||||
|
||||
$(intermediates)/glcpp/glcpp-lex.c: $(LOCAL_PATH)/glcpp/glcpp-lex.l
|
||||
$(intermediates)/glsl/glcpp/glcpp-lex.c: $(LOCAL_PATH)/glsl/glcpp/glcpp-lex.l
|
||||
$(call local-l-or-ll-to-c-or-cpp)
|
||||
|
||||
$(intermediates)/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glcpp/glcpp-parse.y
|
||||
$(intermediates)/glsl/glcpp/glcpp-parse.c: $(LOCAL_PATH)/glsl/glcpp/glcpp-parse.y
|
||||
$(call glsl_local-y-to-c-and-h)
|
||||
|
|
@ -47,7 +47,7 @@ LOCAL_STATIC_LIBRARIES := libmesa_compiler
|
|||
|
||||
LOCAL_MODULE := libmesa_glsl
|
||||
|
||||
include $(LOCAL_PATH)/Android.gen.mk
|
||||
include $(LOCAL_PATH)/Android.glsl.gen.mk
|
||||
include $(MESA_COMMON_MK)
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
|
@ -43,25 +43,6 @@ LOCAL_MODULE := libmesa_compiler
|
|||
include $(MESA_COMMON_MK)
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
# ---------------------------------------
|
||||
# Build libmesa_nir
|
||||
# ---------------------------------------
|
||||
include $(LOCAL_PATH)/Android.glsl.mk
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(NIR_FILES)
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(MESA_TOP)/src/mapi \
|
||||
$(MESA_TOP)/src/mesa \
|
||||
$(MESA_TOP)/src/gallium/include \
|
||||
$(MESA_TOP)/src/gallium/auxiliary
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := libmesa_compiler
|
||||
|
||||
LOCAL_MODULE := libmesa_nir
|
||||
|
||||
include $(LOCAL_PATH)/Android.gen.mk
|
||||
include $(MESA_COMMON_MK)
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
include $(LOCAL_PATH)/Android.nir.mk
|
||||
|
|
|
|||
49
src/compiler/Android.nir.mk
Normal file
49
src/compiler/Android.nir.mk
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# Mesa 3-D graphics library
|
||||
#
|
||||
# Copyright (C) 2015 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 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.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(LOCAL_PATH)/Makefile.sources
|
||||
|
||||
# ---------------------------------------
|
||||
# Build libmesa_nir
|
||||
# ---------------------------------------
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
$(NIR_FILES)
|
||||
|
||||
LOCAL_C_INCLUDES := \
|
||||
$(MESA_TOP)/src/mapi \
|
||||
$(MESA_TOP)/src/mesa \
|
||||
$(MESA_TOP)/src/gallium/include \
|
||||
$(MESA_TOP)/src/gallium/auxiliary
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := libmesa_compiler
|
||||
|
||||
LOCAL_MODULE := libmesa_nir
|
||||
|
||||
include $(LOCAL_PATH)/Android.nir.gen.mk
|
||||
include $(MESA_COMMON_MK)
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
|
|
@ -54,273 +54,8 @@ BUILT_SOURCES =
|
|||
CLEANFILES =
|
||||
EXTRA_DIST = SConscript
|
||||
|
||||
|
||||
EXTRA_DIST += glsl/tests glsl/glcpp/tests glsl/README \
|
||||
glsl/TODO glsl/glcpp/README \
|
||||
glsl/glsl_lexer.ll \
|
||||
glsl/glsl_parser.yy \
|
||||
glsl/glcpp/glcpp-lex.l \
|
||||
glsl/glcpp/glcpp-parse.y \
|
||||
glsl/Makefile.sources \
|
||||
glsl/SConscript
|
||||
|
||||
TESTS += glsl/glcpp/tests/glcpp-test \
|
||||
glsl/glcpp/tests/glcpp-test-cr-lf \
|
||||
glsl/tests/blob-test \
|
||||
glsl/tests/general-ir-test \
|
||||
glsl/tests/optimization-test \
|
||||
glsl/tests/sampler-types-test \
|
||||
glsl/tests/uniform-initializer-test
|
||||
|
||||
TESTS_ENVIRONMENT= \
|
||||
export PYTHON2=$(PYTHON2); \
|
||||
export PYTHON_FLAGS=$(PYTHON_FLAGS);
|
||||
|
||||
check_PROGRAMS += \
|
||||
glsl/glcpp/glcpp \
|
||||
glsl/glsl_test \
|
||||
glsl/tests/blob-test \
|
||||
glsl/tests/general-ir-test \
|
||||
glsl/tests/sampler-types-test \
|
||||
glsl/tests/uniform-initializer-test
|
||||
|
||||
noinst_PROGRAMS = glsl_compiler
|
||||
|
||||
glsl_tests_blob_test_SOURCES = \
|
||||
glsl/tests/blob_test.c
|
||||
glsl_tests_blob_test_LDADD = \
|
||||
glsl/libglsl.la
|
||||
|
||||
glsl_tests_general_ir_test_SOURCES = \
|
||||
glsl/standalone_scaffolding.cpp \
|
||||
glsl/tests/builtin_variable_test.cpp \
|
||||
glsl/tests/invalidate_locations_test.cpp \
|
||||
glsl/tests/general_ir_test.cpp \
|
||||
glsl/tests/varyings_test.cpp
|
||||
glsl_tests_general_ir_test_CFLAGS = \
|
||||
$(PTHREAD_CFLAGS)
|
||||
glsl_tests_general_ir_test_LDADD = \
|
||||
$(top_builddir)/src/gtest/libgtest.la \
|
||||
glsl/libglsl.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
glsl_tests_uniform_initializer_test_SOURCES = \
|
||||
glsl/tests/copy_constant_to_storage_tests.cpp \
|
||||
glsl/tests/set_uniform_initializer_tests.cpp \
|
||||
glsl/tests/uniform_initializer_utils.cpp \
|
||||
glsl/tests/uniform_initializer_utils.h
|
||||
glsl_tests_uniform_initializer_test_CFLAGS = \
|
||||
$(PTHREAD_CFLAGS)
|
||||
glsl_tests_uniform_initializer_test_LDADD = \
|
||||
$(top_builddir)/src/gtest/libgtest.la \
|
||||
glsl/libglsl.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
glsl_tests_sampler_types_test_SOURCES = \
|
||||
glsl/tests/sampler_types_test.cpp
|
||||
glsl_tests_sampler_types_test_CFLAGS = \
|
||||
$(PTHREAD_CFLAGS)
|
||||
glsl_tests_sampler_types_test_LDADD = \
|
||||
$(top_builddir)/src/gtest/libgtest.la \
|
||||
glsl/libglsl.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
noinst_LTLIBRARIES += glsl/libglsl.la glsl/libglcpp.la
|
||||
|
||||
glsl_libglcpp_la_LIBADD = \
|
||||
$(top_builddir)/src/util/libmesautil.la
|
||||
glsl_libglcpp_la_SOURCES = \
|
||||
glsl/glcpp/glcpp-lex.c \
|
||||
glsl/glcpp/glcpp-parse.c \
|
||||
glsl/glcpp/glcpp-parse.h \
|
||||
$(LIBGLCPP_FILES)
|
||||
|
||||
glsl_glcpp_glcpp_SOURCES = \
|
||||
glsl/glcpp/glcpp.c
|
||||
glsl_glcpp_glcpp_LDADD = \
|
||||
glsl/libglcpp.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
-lm
|
||||
|
||||
glsl_libglsl_la_LIBADD = \
|
||||
nir/libnir.la \
|
||||
glsl/libglcpp.la
|
||||
|
||||
glsl_libglsl_la_SOURCES = \
|
||||
glsl/glsl_lexer.cpp \
|
||||
glsl/glsl_parser.cpp \
|
||||
glsl/glsl_parser.h \
|
||||
$(LIBGLSL_FILES)
|
||||
|
||||
|
||||
glsl_compiler_SOURCES = \
|
||||
$(GLSL_COMPILER_CXX_FILES)
|
||||
|
||||
glsl_compiler_LDADD = \
|
||||
glsl/libglsl.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
$(top_builddir)/src/util/libmesautil.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
glsl_glsl_test_SOURCES = \
|
||||
glsl/standalone_scaffolding.cpp \
|
||||
glsl/test.cpp \
|
||||
glsl/test_optpass.cpp \
|
||||
glsl/test_optpass.h
|
||||
|
||||
glsl_glsl_test_LDADD = \
|
||||
glsl/libglsl.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
# We write our own rules for yacc and lex below. We'd rather use automake,
|
||||
# but automake makes it especially difficult for a number of reasons:
|
||||
#
|
||||
# * < automake-1.12 generates .h files from .yy and .ypp files, but
|
||||
# >=automake-1.12 generates .hh and .hpp files respectively. There's no
|
||||
# good way of making a project that uses C++ yacc files compatible with
|
||||
# both versions of automake. Strong work automake developers.
|
||||
#
|
||||
# * Since we're generating code from .l/.y files in a subdirectory (glcpp/)
|
||||
# we'd like the resulting generated code to also go in glcpp/ for purposes
|
||||
# of distribution. Automake gives no way to do this.
|
||||
#
|
||||
# * Since we're building multiple yacc parsers into one library (and via one
|
||||
# Makefile) we have to use per-target YFLAGS. Using per-target YFLAGS causes
|
||||
# automake to name the resulting generated code as <library-name>_filename.c.
|
||||
# Frankly, that's ugly and we don't want a libglcpp_glcpp_parser.h file.
|
||||
|
||||
# In order to make build output print "LEX" and "YACC", we reproduce the
|
||||
# automake variables below.
|
||||
|
||||
AM_V_LEX = $(am__v_LEX_$(V))
|
||||
am__v_LEX_ = $(am__v_LEX_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_LEX_0 = @echo " LEX " $@;
|
||||
am__v_LEX_1 =
|
||||
|
||||
AM_V_YACC = $(am__v_YACC_$(V))
|
||||
am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_YACC_0 = @echo " YACC " $@;
|
||||
am__v_YACC_1 =
|
||||
|
||||
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
|
||||
YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
|
||||
LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
|
||||
|
||||
glsl/glsl_parser.cpp glsl/glsl_parser.h: glsl/glsl_parser.yy
|
||||
$(MKDIR_GEN)
|
||||
$(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl/glsl_parser.h $(srcdir)/glsl/glsl_parser.yy
|
||||
include Makefile.glsl.am
|
||||
|
||||
glsl/glsl_lexer.cpp: glsl/glsl_lexer.ll
|
||||
$(MKDIR_GEN)
|
||||
$(LEX_GEN) -o $@ $(srcdir)/glsl/glsl_lexer.ll
|
||||
|
||||
glsl/glcpp/glcpp-parse.c glsl/glcpp/glcpp-parse.h: glsl/glcpp/glcpp-parse.y
|
||||
$(MKDIR_GEN)
|
||||
$(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glsl/glcpp/glcpp-parse.h $(srcdir)/glsl/glcpp/glcpp-parse.y
|
||||
|
||||
glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
|
||||
$(MKDIR_GEN)
|
||||
$(LEX_GEN) -o $@ $(srcdir)/glsl/glcpp/glcpp-lex.l
|
||||
|
||||
# Only the parsers (specifically the header files generated at the same time)
|
||||
# need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
|
||||
# called for the .c/.cpp file and the .h files. By listing the .c/.cpp files
|
||||
# YACC is only executed once for each parser. The rest of the generated code
|
||||
# will be created at the appropriate times according to standard automake
|
||||
# dependency rules.
|
||||
BUILT_SOURCES += \
|
||||
glsl/glsl_parser.cpp \
|
||||
glsl/glsl_lexer.cpp \
|
||||
glsl/glcpp/glcpp-parse.c \
|
||||
glsl/glcpp/glcpp-lex.c
|
||||
CLEANFILES += \
|
||||
glsl/glcpp/glcpp-parse.h \
|
||||
glsl/glsl_parser.h \
|
||||
glsl/glsl_parser.cpp \
|
||||
glsl/glsl_lexer.cpp \
|
||||
glsl/glcpp/glcpp-parse.c \
|
||||
glsl/glcpp/glcpp-lex.c
|
||||
|
||||
clean-local:
|
||||
$(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
|
||||
|
||||
dist-hook:
|
||||
$(RM) glsl/glcpp/tests/*.out
|
||||
$(RM) glsl/glcpp/tests/subtest*/*.out
|
||||
|
||||
noinst_LTLIBRARIES += nir/libnir.la
|
||||
|
||||
nir_libnir_la_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
-I$(top_builddir)/src/compiler/nir \
|
||||
-I$(top_srcdir)/src/compiler/nir
|
||||
|
||||
nir_libnir_la_LIBADD = \
|
||||
libcompiler.la
|
||||
|
||||
nir_libnir_la_SOURCES = \
|
||||
$(NIR_FILES) \
|
||||
$(SPIRV_FILES) \
|
||||
$(NIR_GENERATED_FILES)
|
||||
|
||||
PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
|
||||
|
||||
nir/nir_builder_opcodes.h: nir/nir_opcodes.py nir/nir_builder_opcodes_h.py
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) $(srcdir)/nir/nir_builder_opcodes_h.py > $@ || ($(RM) $@; false)
|
||||
|
||||
nir/nir_constant_expressions.c: nir/nir_opcodes.py nir/nir_constant_expressions.py
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) $(srcdir)/nir/nir_constant_expressions.py > $@ || ($(RM) $@; false)
|
||||
|
||||
nir/nir_opcodes.h: nir/nir_opcodes.py nir/nir_opcodes_h.py
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_h.py > $@ || ($(RM) $@; false)
|
||||
|
||||
nir/nir_opcodes.c: nir/nir_opcodes.py nir/nir_opcodes_c.py
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_c.py > $@ || ($(RM) $@; false)
|
||||
|
||||
nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) $(srcdir)/nir/nir_opt_algebraic.py > $@ || ($(RM) $@; false)
|
||||
|
||||
|
||||
check_PROGRAMS += nir/tests/control_flow_tests
|
||||
|
||||
nir_tests_control_flow_tests_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
-I$(top_builddir)/src/compiler/nir \
|
||||
-I$(top_srcdir)/src/compiler/nir
|
||||
|
||||
nir_tests_control_flow_tests_SOURCES = \
|
||||
nir/tests/control_flow_tests.cpp
|
||||
nir_tests_control_flow_tests_CFLAGS = \
|
||||
$(PTHREAD_CFLAGS)
|
||||
nir_tests_control_flow_tests_LDADD = \
|
||||
$(top_builddir)/src/gtest/libgtest.la \
|
||||
nir/libnir.la \
|
||||
$(top_builddir)/src/util/libmesautil.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
|
||||
TESTS += nir/tests/control_flow_tests
|
||||
|
||||
|
||||
BUILT_SOURCES += $(NIR_GENERATED_FILES)
|
||||
CLEANFILES += $(NIR_GENERATED_FILES)
|
||||
|
||||
EXTRA_DIST += \
|
||||
nir/nir_algebraic.py \
|
||||
nir/nir_builder_opcodes_h.py \
|
||||
nir/nir_constant_expressions.py \
|
||||
nir/nir_opcodes.py \
|
||||
nir/nir_opcodes_c.py \
|
||||
nir/nir_opcodes_h.py \
|
||||
nir/nir_opt_algebraic.py \
|
||||
nir/tests \
|
||||
nir/Makefile.sources
|
||||
include Makefile.nir.am
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#
|
||||
# Copyright © 2012 Jon TURNEY
|
||||
# Copyright (C) 2015 Intel Corporation
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
|
|
@ -19,120 +21,103 @@
|
|||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
# IN THE SOFTWARE.
|
||||
|
||||
AM_CPPFLAGS = \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src \
|
||||
-I$(top_srcdir)/src/mapi \
|
||||
-I$(top_srcdir)/src/mesa/ \
|
||||
-I$(top_srcdir)/src/gallium/include \
|
||||
-I$(top_srcdir)/src/gallium/auxiliary \
|
||||
-I$(top_srcdir)/src/glsl/glcpp \
|
||||
-I$(top_srcdir)/src/gtest/include \
|
||||
$(DEFINES)
|
||||
AM_CFLAGS = \
|
||||
$(VISIBILITY_CFLAGS) \
|
||||
$(MSVC2013_COMPAT_CFLAGS)
|
||||
AM_CXXFLAGS = \
|
||||
$(VISIBILITY_CXXFLAGS) \
|
||||
$(MSVC2013_COMPAT_CXXFLAGS)
|
||||
EXTRA_DIST += glsl/tests glsl/glcpp/tests glsl/README \
|
||||
glsl/TODO glsl/glcpp/README \
|
||||
glsl/glsl_lexer.ll \
|
||||
glsl/glsl_parser.yy \
|
||||
glsl/glcpp/glcpp-lex.l \
|
||||
glsl/glcpp/glcpp-parse.y \
|
||||
SConscript.glsl
|
||||
|
||||
EXTRA_DIST = tests glcpp/tests README TODO glcpp/README \
|
||||
glsl_lexer.ll \
|
||||
glsl_parser.yy \
|
||||
glcpp/glcpp-lex.l \
|
||||
glcpp/glcpp-parse.y \
|
||||
SConscript
|
||||
|
||||
include Makefile.sources
|
||||
|
||||
TESTS = glcpp/tests/glcpp-test \
|
||||
glcpp/tests/glcpp-test-cr-lf \
|
||||
tests/blob-test \
|
||||
tests/general-ir-test \
|
||||
tests/optimization-test \
|
||||
tests/sampler-types-test \
|
||||
tests/uniform-initializer-test
|
||||
TESTS += glsl/glcpp/tests/glcpp-test \
|
||||
glsl/glcpp/tests/glcpp-test-cr-lf \
|
||||
glsl/tests/blob-test \
|
||||
glsl/tests/general-ir-test \
|
||||
glsl/tests/optimization-test \
|
||||
glsl/tests/sampler-types-test \
|
||||
glsl/tests/uniform-initializer-test
|
||||
|
||||
TESTS_ENVIRONMENT= \
|
||||
export PYTHON2=$(PYTHON2); \
|
||||
export PYTHON_FLAGS=$(PYTHON_FLAGS);
|
||||
|
||||
noinst_LTLIBRARIES = libglsl.la libglcpp.la
|
||||
check_PROGRAMS = \
|
||||
glcpp/glcpp \
|
||||
glsl_test \
|
||||
tests/blob-test \
|
||||
tests/general-ir-test \
|
||||
tests/sampler-types-test \
|
||||
tests/uniform-initializer-test
|
||||
check_PROGRAMS += \
|
||||
glsl/glcpp/glcpp \
|
||||
glsl/glsl_test \
|
||||
glsl/tests/blob-test \
|
||||
glsl/tests/general-ir-test \
|
||||
glsl/tests/sampler-types-test \
|
||||
glsl/tests/uniform-initializer-test
|
||||
|
||||
noinst_PROGRAMS = glsl_compiler
|
||||
|
||||
tests_blob_test_SOURCES = \
|
||||
tests/blob_test.c
|
||||
tests_blob_test_LDADD = \
|
||||
$(top_builddir)/src/glsl/libglsl.la
|
||||
glsl_tests_blob_test_SOURCES = \
|
||||
glsl/tests/blob_test.c
|
||||
glsl_tests_blob_test_LDADD = \
|
||||
glsl/libglsl.la
|
||||
|
||||
tests_general_ir_test_SOURCES = \
|
||||
standalone_scaffolding.cpp \
|
||||
tests/builtin_variable_test.cpp \
|
||||
tests/invalidate_locations_test.cpp \
|
||||
tests/general_ir_test.cpp \
|
||||
tests/varyings_test.cpp
|
||||
tests_general_ir_test_CFLAGS = \
|
||||
glsl_tests_general_ir_test_SOURCES = \
|
||||
glsl/standalone_scaffolding.cpp \
|
||||
glsl/tests/builtin_variable_test.cpp \
|
||||
glsl/tests/invalidate_locations_test.cpp \
|
||||
glsl/tests/general_ir_test.cpp \
|
||||
glsl/tests/varyings_test.cpp
|
||||
glsl_tests_general_ir_test_CFLAGS = \
|
||||
$(PTHREAD_CFLAGS)
|
||||
tests_general_ir_test_LDADD = \
|
||||
glsl_tests_general_ir_test_LDADD = \
|
||||
$(top_builddir)/src/gtest/libgtest.la \
|
||||
$(top_builddir)/src/glsl/libglsl.la \
|
||||
glsl/libglsl.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
tests_uniform_initializer_test_SOURCES = \
|
||||
tests/copy_constant_to_storage_tests.cpp \
|
||||
tests/set_uniform_initializer_tests.cpp \
|
||||
tests/uniform_initializer_utils.cpp \
|
||||
tests/uniform_initializer_utils.h
|
||||
tests_uniform_initializer_test_CFLAGS = \
|
||||
glsl_tests_uniform_initializer_test_SOURCES = \
|
||||
glsl/tests/copy_constant_to_storage_tests.cpp \
|
||||
glsl/tests/set_uniform_initializer_tests.cpp \
|
||||
glsl/tests/uniform_initializer_utils.cpp \
|
||||
glsl/tests/uniform_initializer_utils.h
|
||||
glsl_tests_uniform_initializer_test_CFLAGS = \
|
||||
$(PTHREAD_CFLAGS)
|
||||
tests_uniform_initializer_test_LDADD = \
|
||||
glsl_tests_uniform_initializer_test_LDADD = \
|
||||
$(top_builddir)/src/gtest/libgtest.la \
|
||||
$(top_builddir)/src/glsl/libglsl.la \
|
||||
glsl/libglsl.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
tests_sampler_types_test_SOURCES = \
|
||||
tests/sampler_types_test.cpp
|
||||
tests_sampler_types_test_CFLAGS = \
|
||||
glsl_tests_sampler_types_test_SOURCES = \
|
||||
glsl/tests/sampler_types_test.cpp
|
||||
glsl_tests_sampler_types_test_CFLAGS = \
|
||||
$(PTHREAD_CFLAGS)
|
||||
tests_sampler_types_test_LDADD = \
|
||||
glsl_tests_sampler_types_test_LDADD = \
|
||||
$(top_builddir)/src/gtest/libgtest.la \
|
||||
$(top_builddir)/src/glsl/libglsl.la \
|
||||
glsl/libglsl.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
libglcpp_la_LIBADD = \
|
||||
noinst_LTLIBRARIES += glsl/libglsl.la glsl/libglcpp.la
|
||||
|
||||
glsl_libglcpp_la_LIBADD = \
|
||||
$(top_builddir)/src/util/libmesautil.la
|
||||
libglcpp_la_SOURCES = \
|
||||
glcpp/glcpp-lex.c \
|
||||
glcpp/glcpp-parse.c \
|
||||
glcpp/glcpp-parse.h \
|
||||
glsl_libglcpp_la_SOURCES = \
|
||||
glsl/glcpp/glcpp-lex.c \
|
||||
glsl/glcpp/glcpp-parse.c \
|
||||
glsl/glcpp/glcpp-parse.h \
|
||||
$(LIBGLCPP_FILES)
|
||||
|
||||
glcpp_glcpp_SOURCES = \
|
||||
glcpp/glcpp.c
|
||||
glcpp_glcpp_LDADD = \
|
||||
libglcpp.la \
|
||||
glsl_glcpp_glcpp_SOURCES = \
|
||||
glsl/glcpp/glcpp.c
|
||||
glsl_glcpp_glcpp_LDADD = \
|
||||
glsl/libglcpp.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
-lm
|
||||
|
||||
libglsl_la_LIBADD = \
|
||||
$(top_builddir)/src/compiler/nir/libnir.la \
|
||||
libglcpp.la
|
||||
glsl_libglsl_la_LIBADD = \
|
||||
nir/libnir.la \
|
||||
glsl/libglcpp.la
|
||||
|
||||
libglsl_la_SOURCES = \
|
||||
glsl_lexer.cpp \
|
||||
glsl_parser.cpp \
|
||||
glsl_parser.h \
|
||||
glsl_libglsl_la_SOURCES = \
|
||||
glsl/glsl_lexer.cpp \
|
||||
glsl/glsl_parser.cpp \
|
||||
glsl/glsl_parser.h \
|
||||
$(LIBGLSL_FILES)
|
||||
|
||||
|
||||
|
|
@ -140,19 +125,19 @@ glsl_compiler_SOURCES = \
|
|||
$(GLSL_COMPILER_CXX_FILES)
|
||||
|
||||
glsl_compiler_LDADD = \
|
||||
libglsl.la \
|
||||
glsl/libglsl.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
$(top_builddir)/src/util/libmesautil.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
glsl_test_SOURCES = \
|
||||
standalone_scaffolding.cpp \
|
||||
test.cpp \
|
||||
test_optpass.cpp \
|
||||
test_optpass.h
|
||||
glsl_glsl_test_SOURCES = \
|
||||
glsl/standalone_scaffolding.cpp \
|
||||
glsl/test.cpp \
|
||||
glsl/test_optpass.cpp \
|
||||
glsl/test_optpass.h
|
||||
|
||||
glsl_test_LDADD = \
|
||||
libglsl.la \
|
||||
glsl_glsl_test_LDADD = \
|
||||
glsl/libglsl.la \
|
||||
$(top_builddir)/src/libglsl_util.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
|
|
@ -186,23 +171,24 @@ am__v_YACC_ = $(am__v_YACC_$(AM_DEFAULT_VERBOSITY))
|
|||
am__v_YACC_0 = @echo " YACC " $@;
|
||||
am__v_YACC_1 =
|
||||
|
||||
MKDIR_GEN = $(AM_V_at)$(MKDIR_P) $(@D)
|
||||
YACC_GEN = $(AM_V_YACC)$(YACC) $(YFLAGS)
|
||||
LEX_GEN = $(AM_V_LEX)$(LEX) $(LFLAGS)
|
||||
|
||||
glsl_parser.cpp glsl_parser.h: glsl_parser.yy
|
||||
$(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl_parser.h $(srcdir)/glsl_parser.yy
|
||||
|
||||
glsl_lexer.cpp: glsl_lexer.ll
|
||||
$(LEX_GEN) -o $@ $(srcdir)/glsl_lexer.ll
|
||||
|
||||
glcpp/glcpp-parse.c glcpp/glcpp-parse.h: glcpp/glcpp-parse.y
|
||||
glsl/glsl_parser.cpp glsl/glsl_parser.h: glsl/glsl_parser.yy
|
||||
$(MKDIR_GEN)
|
||||
$(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glcpp/glcpp-parse.h $(srcdir)/glcpp/glcpp-parse.y
|
||||
$(YACC_GEN) -o $@ -p "_mesa_glsl_" --defines=$(builddir)/glsl/glsl_parser.h $(srcdir)/glsl/glsl_parser.yy
|
||||
|
||||
glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
|
||||
glsl/glsl_lexer.cpp: glsl/glsl_lexer.ll
|
||||
$(MKDIR_GEN)
|
||||
$(LEX_GEN) -o $@ $(srcdir)/glcpp/glcpp-lex.l
|
||||
$(LEX_GEN) -o $@ $(srcdir)/glsl/glsl_lexer.ll
|
||||
|
||||
glsl/glcpp/glcpp-parse.c glsl/glcpp/glcpp-parse.h: glsl/glcpp/glcpp-parse.y
|
||||
$(MKDIR_GEN)
|
||||
$(YACC_GEN) -o $@ -p "glcpp_parser_" --defines=$(builddir)/glsl/glcpp/glcpp-parse.h $(srcdir)/glsl/glcpp/glcpp-parse.y
|
||||
|
||||
glsl/glcpp/glcpp-lex.c: glsl/glcpp/glcpp-lex.l
|
||||
$(MKDIR_GEN)
|
||||
$(LEX_GEN) -o $@ $(srcdir)/glsl/glcpp/glcpp-lex.l
|
||||
|
||||
# Only the parsers (specifically the header files generated at the same time)
|
||||
# need to be in BUILT_SOURCES. Though if we list the parser headers YACC is
|
||||
|
|
@ -210,19 +196,22 @@ glcpp/glcpp-lex.c: glcpp/glcpp-lex.l
|
|||
# YACC is only executed once for each parser. The rest of the generated code
|
||||
# will be created at the appropriate times according to standard automake
|
||||
# dependency rules.
|
||||
BUILT_SOURCES = \
|
||||
glsl_parser.cpp \
|
||||
glsl_lexer.cpp \
|
||||
glcpp/glcpp-parse.c \
|
||||
glcpp/glcpp-lex.c
|
||||
CLEANFILES = \
|
||||
glcpp/glcpp-parse.h \
|
||||
glsl_parser.h \
|
||||
$(BUILT_SOURCES)
|
||||
BUILT_SOURCES += \
|
||||
glsl/glsl_parser.cpp \
|
||||
glsl/glsl_lexer.cpp \
|
||||
glsl/glcpp/glcpp-parse.c \
|
||||
glsl/glcpp/glcpp-lex.c
|
||||
CLEANFILES += \
|
||||
glsl/glcpp/glcpp-parse.h \
|
||||
glsl/glsl_parser.h \
|
||||
glsl/glsl_parser.cpp \
|
||||
glsl/glsl_lexer.cpp \
|
||||
glsl/glcpp/glcpp-parse.c \
|
||||
glsl/glcpp/glcpp-lex.c
|
||||
|
||||
clean-local:
|
||||
$(RM) -r subtest-cr subtest-cr-lf subtest-lf subtest-lf-cr
|
||||
|
||||
dist-hook:
|
||||
$(RM) glcpp/tests/*.out
|
||||
$(RM) glcpp/tests/subtest*/*.out
|
||||
$(RM) glsl/glcpp/tests/*.out
|
||||
$(RM) glsl/glcpp/tests/subtest*/*.out
|
||||
94
src/compiler/Makefile.nir.am
Normal file
94
src/compiler/Makefile.nir.am
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
#
|
||||
# Copyright © 2012 Jon TURNEY
|
||||
# Copyright (C) 2015 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.
|
||||
|
||||
noinst_LTLIBRARIES += nir/libnir.la
|
||||
|
||||
nir_libnir_la_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
-I$(top_builddir)/src/compiler/nir \
|
||||
-I$(top_srcdir)/src/compiler/nir
|
||||
|
||||
nir_libnir_la_LIBADD = \
|
||||
libcompiler.la
|
||||
|
||||
nir_libnir_la_SOURCES = \
|
||||
$(NIR_FILES) \
|
||||
$(SPIRV_FILES) \
|
||||
$(NIR_GENERATED_FILES)
|
||||
|
||||
PYTHON_GEN = $(AM_V_GEN)$(PYTHON2) $(PYTHON_FLAGS)
|
||||
|
||||
nir/nir_builder_opcodes.h: nir/nir_opcodes.py nir/nir_builder_opcodes_h.py
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) $(srcdir)/nir/nir_builder_opcodes_h.py > $@ || ($(RM) $@; false)
|
||||
|
||||
nir/nir_constant_expressions.c: nir/nir_opcodes.py nir/nir_constant_expressions.py
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) $(srcdir)/nir/nir_constant_expressions.py > $@ || ($(RM) $@; false)
|
||||
|
||||
nir/nir_opcodes.h: nir/nir_opcodes.py nir/nir_opcodes_h.py
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_h.py > $@ || ($(RM) $@; false)
|
||||
|
||||
nir/nir_opcodes.c: nir/nir_opcodes.py nir/nir_opcodes_c.py
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) $(srcdir)/nir/nir_opcodes_c.py > $@ || ($(RM) $@; false)
|
||||
|
||||
nir/nir_opt_algebraic.c: nir/nir_opt_algebraic.py nir/nir_algebraic.py
|
||||
$(MKDIR_GEN)
|
||||
$(PYTHON_GEN) $(srcdir)/nir/nir_opt_algebraic.py > $@ || ($(RM) $@; false)
|
||||
|
||||
|
||||
check_PROGRAMS += nir/tests/control_flow_tests
|
||||
|
||||
nir_tests_control_flow_tests_CPPFLAGS = \
|
||||
$(AM_CPPFLAGS) \
|
||||
-I$(top_builddir)/src/compiler/nir \
|
||||
-I$(top_srcdir)/src/compiler/nir
|
||||
|
||||
nir_tests_control_flow_tests_SOURCES = \
|
||||
nir/tests/control_flow_tests.cpp
|
||||
nir_tests_control_flow_tests_CFLAGS = \
|
||||
$(PTHREAD_CFLAGS)
|
||||
nir_tests_control_flow_tests_LDADD = \
|
||||
$(top_builddir)/src/gtest/libgtest.la \
|
||||
nir/libnir.la \
|
||||
$(top_builddir)/src/util/libmesautil.la \
|
||||
$(PTHREAD_LIBS)
|
||||
|
||||
|
||||
TESTS += nir/tests/control_flow_tests
|
||||
|
||||
|
||||
BUILT_SOURCES += $(NIR_GENERATED_FILES)
|
||||
CLEANFILES += $(NIR_GENERATED_FILES)
|
||||
|
||||
EXTRA_DIST += \
|
||||
nir/nir_algebraic.py \
|
||||
nir/nir_builder_opcodes_h.py \
|
||||
nir/nir_constant_expressions.py \
|
||||
nir/nir_opcodes.py \
|
||||
nir/nir_opcodes_c.py \
|
||||
nir/nir_opcodes_h.py \
|
||||
nir/nir_opt_algebraic.py \
|
||||
nir/tests
|
||||
|
|
@ -187,6 +187,7 @@ NIR_FILES = \
|
|||
nir/nir_lower_alu_to_scalar.c \
|
||||
nir/nir_lower_atomics.c \
|
||||
nir/nir_lower_clip.c \
|
||||
nir/nir_lower_double_packing.c \
|
||||
nir/nir_lower_global_vars_to_local.c \
|
||||
nir/nir_lower_gs_intrinsics.c \
|
||||
nir/nir_lower_load_const_to_scalar.c \
|
||||
|
|
|
|||
|
|
@ -21,4 +21,4 @@ compiler = env.ConvenienceLibrary(
|
|||
)
|
||||
Export('compiler')
|
||||
|
||||
SConscript('glsl/SConscript')
|
||||
SConscript('SConscript.glsl')
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@ env.Prepend(CPPPATH = [
|
|||
'#src/mesa',
|
||||
'#src/gallium/include',
|
||||
'#src/gallium/auxiliary',
|
||||
'#src/glsl',
|
||||
'#src/glsl/glcpp',
|
||||
'#src/compiler/glsl',
|
||||
'#src/compiler/glsl/glcpp',
|
||||
])
|
||||
|
||||
env.Prepend(LIBS = [mesautil])
|
||||
|
||||
# Make glcpp-parse.h and glsl_parser.h reachable from the include path.
|
||||
env.Append(CPPPATH = [Dir('.').abspath, Dir('glcpp').abspath])
|
||||
env.Prepend(CPPPATH = [Dir('.').abspath, Dir('glsl').abspath])
|
||||
|
||||
glcpp_env = env.Clone()
|
||||
glcpp_env.Append(YACCFLAGS = [
|
||||
|
|
@ -32,7 +32,7 @@ glcpp_env.Append(YACCFLAGS = [
|
|||
|
||||
glsl_env = env.Clone()
|
||||
glsl_env.Append(YACCFLAGS = [
|
||||
'--defines=%s' % File('glsl_parser.h').abspath,
|
||||
'--defines=%s' % File('glsl/glsl_parser.h').abspath,
|
||||
'-p', '_mesa_glsl_',
|
||||
])
|
||||
|
||||
|
|
@ -40,10 +40,10 @@ glsl_env.Append(YACCFLAGS = [
|
|||
# "glsl_parser.h", causing glsl_parser.cpp to be regenerated every time
|
||||
glsl_env['YACCHXXFILESUFFIX'] = '.h'
|
||||
|
||||
glcpp_lexer = glcpp_env.CFile('glcpp/glcpp-lex.c', 'glcpp/glcpp-lex.l')
|
||||
glcpp_parser = glcpp_env.CFile('glcpp/glcpp-parse.c', 'glcpp/glcpp-parse.y')
|
||||
glsl_lexer = glsl_env.CXXFile('glsl_lexer.cpp', 'glsl_lexer.ll')
|
||||
glsl_parser = glsl_env.CXXFile('glsl_parser.cpp', 'glsl_parser.yy')
|
||||
glcpp_lexer = glcpp_env.CFile('glsl/glcpp/glcpp-lex.c', 'glsl/glcpp/glcpp-lex.l')
|
||||
glcpp_parser = glcpp_env.CFile('glsl/glcpp/glcpp-parse.c', 'glsl/glcpp/glcpp-parse.y')
|
||||
glsl_lexer = glsl_env.CXXFile('glsl/glsl_lexer.cpp', 'glsl/glsl_lexer.ll')
|
||||
glsl_parser = glsl_env.CXXFile('glsl/glsl_parser.cpp', 'glsl/glsl_parser.yy')
|
||||
|
||||
# common generated sources
|
||||
glsl_sources = [
|
||||
|
|
@ -66,20 +66,20 @@ if env['msvc']:
|
|||
|
||||
# Copy these files to avoid generation object files into src/mesa/program
|
||||
env.Prepend(CPPPATH = ['#src/mesa/main'])
|
||||
env.Command('imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))
|
||||
env.Command('glsl/imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))
|
||||
# Copy these files to avoid generation object files into src/mesa/program
|
||||
env.Prepend(CPPPATH = ['#src/mesa/program'])
|
||||
env.Command('prog_hash_table.c', '#src/mesa/program/prog_hash_table.c', Copy('$TARGET', '$SOURCE'))
|
||||
env.Command('symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE'))
|
||||
env.Command('dummy_errors.c', '#src/mesa/program/dummy_errors.c', Copy('$TARGET', '$SOURCE'))
|
||||
env.Command('glsl/prog_hash_table.c', '#src/mesa/program/prog_hash_table.c', Copy('$TARGET', '$SOURCE'))
|
||||
env.Command('glsl/symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE'))
|
||||
env.Command('glsl/dummy_errors.c', '#src/mesa/program/dummy_errors.c', Copy('$TARGET', '$SOURCE'))
|
||||
|
||||
compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES'])
|
||||
|
||||
mesa_objs = env.StaticObject([
|
||||
'imports.c',
|
||||
'prog_hash_table.c',
|
||||
'symbol_table.c',
|
||||
'dummy_errors.c',
|
||||
'glsl/imports.c',
|
||||
'glsl/prog_hash_table.c',
|
||||
'glsl/symbol_table.c',
|
||||
'glsl/dummy_errors.c',
|
||||
])
|
||||
|
||||
compiler_objs += mesa_objs
|
||||
|
|
@ -116,7 +116,7 @@ glsl_compiler = env.Program(
|
|||
env.Alias('glsl_compiler', glsl_compiler)
|
||||
|
||||
glcpp = env.Program(
|
||||
target = 'glcpp/glcpp',
|
||||
source = ['glcpp/glcpp.c'] + mesa_objs,
|
||||
target = 'glsl/glcpp/glcpp',
|
||||
source = ['glsl/glcpp/glcpp.c'] + mesa_objs,
|
||||
)
|
||||
env.Alias('glcpp', glcpp)
|
||||
|
|
@ -1,223 +0,0 @@
|
|||
# shared source lists for Makefile, SConscript, and Android.mk
|
||||
|
||||
# libglcpp
|
||||
|
||||
LIBGLCPP_FILES = \
|
||||
glcpp/glcpp.h \
|
||||
glcpp/pp.c
|
||||
|
||||
LIBGLCPP_GENERATED_FILES = \
|
||||
glcpp/glcpp-lex.c \
|
||||
glcpp/glcpp-parse.c
|
||||
|
||||
NIR_GENERATED_FILES = \
|
||||
nir/nir_builder_opcodes.h \
|
||||
nir/nir_constant_expressions.c \
|
||||
nir/nir_opcodes.c \
|
||||
nir/nir_opcodes.h \
|
||||
nir/nir_opt_algebraic.c
|
||||
|
||||
NIR_FILES = \
|
||||
nir/nir.c \
|
||||
nir/nir.h \
|
||||
nir/nir_array.h \
|
||||
nir/nir_builder.h \
|
||||
nir/nir_clone.c \
|
||||
nir/nir_constant_expressions.h \
|
||||
nir/nir_control_flow.c \
|
||||
nir/nir_control_flow.h \
|
||||
nir/nir_control_flow_private.h \
|
||||
nir/nir_dominance.c \
|
||||
nir/nir_from_ssa.c \
|
||||
nir/nir_gs_count_vertices.c \
|
||||
nir/nir_intrinsics.c \
|
||||
nir/nir_intrinsics.h \
|
||||
nir/nir_instr_set.c \
|
||||
nir/nir_instr_set.h \
|
||||
nir/nir_liveness.c \
|
||||
nir/nir_lower_alu_to_scalar.c \
|
||||
nir/nir_lower_atomics.c \
|
||||
nir/nir_lower_clip.c \
|
||||
nir/nir_lower_global_vars_to_local.c \
|
||||
nir/nir_lower_gs_intrinsics.c \
|
||||
nir/nir_lower_load_const_to_scalar.c \
|
||||
nir/nir_lower_locals_to_regs.c \
|
||||
nir/nir_lower_idiv.c \
|
||||
nir/nir_lower_io.c \
|
||||
nir/nir_lower_outputs_to_temporaries.c \
|
||||
nir/nir_lower_phis_to_scalar.c \
|
||||
nir/nir_lower_samplers.c \
|
||||
nir/nir_lower_system_values.c \
|
||||
nir/nir_lower_tex.c \
|
||||
nir/nir_lower_to_source_mods.c \
|
||||
nir/nir_lower_two_sided_color.c \
|
||||
nir/nir_lower_vars_to_ssa.c \
|
||||
nir/nir_lower_var_copies.c \
|
||||
nir/nir_lower_vec_to_movs.c \
|
||||
nir/nir_metadata.c \
|
||||
nir/nir_move_vec_src_uses_to_dest.c \
|
||||
nir/nir_normalize_cubemap_coords.c \
|
||||
nir/nir_opt_constant_folding.c \
|
||||
nir/nir_opt_copy_propagate.c \
|
||||
nir/nir_opt_cse.c \
|
||||
nir/nir_opt_dce.c \
|
||||
nir/nir_opt_dead_cf.c \
|
||||
nir/nir_opt_gcm.c \
|
||||
nir/nir_opt_global_to_local.c \
|
||||
nir/nir_opt_peephole_select.c \
|
||||
nir/nir_opt_remove_phis.c \
|
||||
nir/nir_opt_undef.c \
|
||||
nir/nir_print.c \
|
||||
nir/nir_remove_dead_variables.c \
|
||||
nir/nir_search.c \
|
||||
nir/nir_search.h \
|
||||
nir/nir_split_var_copies.c \
|
||||
nir/nir_sweep.c \
|
||||
nir/nir_to_ssa.c \
|
||||
nir/nir_validate.c \
|
||||
nir/nir_vla.h \
|
||||
nir/nir_worklist.c \
|
||||
nir/nir_worklist.h
|
||||
|
||||
# libglsl
|
||||
|
||||
LIBGLSL_FILES = \
|
||||
ast.h \
|
||||
ast_array_index.cpp \
|
||||
ast_expr.cpp \
|
||||
ast_function.cpp \
|
||||
ast_to_hir.cpp \
|
||||
ast_type.cpp \
|
||||
blob.c \
|
||||
blob.h \
|
||||
builtin_functions.cpp \
|
||||
builtin_types.cpp \
|
||||
builtin_variables.cpp \
|
||||
glsl_parser_extras.cpp \
|
||||
glsl_parser_extras.h \
|
||||
glsl_symbol_table.cpp \
|
||||
glsl_symbol_table.h \
|
||||
hir_field_selection.cpp \
|
||||
ir_basic_block.cpp \
|
||||
ir_basic_block.h \
|
||||
ir_builder.cpp \
|
||||
ir_builder.h \
|
||||
ir_clone.cpp \
|
||||
ir_constant_expression.cpp \
|
||||
ir.cpp \
|
||||
ir.h \
|
||||
ir_equals.cpp \
|
||||
ir_expression_flattening.cpp \
|
||||
ir_expression_flattening.h \
|
||||
ir_function_can_inline.cpp \
|
||||
ir_function_detect_recursion.cpp \
|
||||
ir_function_inlining.h \
|
||||
ir_function.cpp \
|
||||
ir_hierarchical_visitor.cpp \
|
||||
ir_hierarchical_visitor.h \
|
||||
ir_hv_accept.cpp \
|
||||
ir_import_prototypes.cpp \
|
||||
ir_optimization.h \
|
||||
ir_print_visitor.cpp \
|
||||
ir_print_visitor.h \
|
||||
ir_reader.cpp \
|
||||
ir_reader.h \
|
||||
ir_rvalue_visitor.cpp \
|
||||
ir_rvalue_visitor.h \
|
||||
ir_set_program_inouts.cpp \
|
||||
ir_uniform.h \
|
||||
ir_validate.cpp \
|
||||
ir_variable_refcount.cpp \
|
||||
ir_variable_refcount.h \
|
||||
ir_visitor.h \
|
||||
linker.cpp \
|
||||
linker.h \
|
||||
link_atomics.cpp \
|
||||
link_functions.cpp \
|
||||
link_interface_blocks.cpp \
|
||||
link_uniforms.cpp \
|
||||
link_uniform_initializers.cpp \
|
||||
link_uniform_block_active_visitor.cpp \
|
||||
link_uniform_block_active_visitor.h \
|
||||
link_uniform_blocks.cpp \
|
||||
link_varyings.cpp \
|
||||
link_varyings.h \
|
||||
list.h \
|
||||
loop_analysis.cpp \
|
||||
loop_analysis.h \
|
||||
loop_controls.cpp \
|
||||
loop_unroll.cpp \
|
||||
lower_buffer_access.cpp \
|
||||
lower_buffer_access.h \
|
||||
lower_clip_distance.cpp \
|
||||
lower_const_arrays_to_uniforms.cpp \
|
||||
lower_discard.cpp \
|
||||
lower_discard_flow.cpp \
|
||||
lower_if_to_cond_assign.cpp \
|
||||
lower_instructions.cpp \
|
||||
lower_jumps.cpp \
|
||||
lower_mat_op_to_vec.cpp \
|
||||
lower_noise.cpp \
|
||||
lower_offset_array.cpp \
|
||||
lower_packed_varyings.cpp \
|
||||
lower_named_interface_blocks.cpp \
|
||||
lower_packing_builtins.cpp \
|
||||
lower_subroutine.cpp \
|
||||
lower_tess_level.cpp \
|
||||
lower_texture_projection.cpp \
|
||||
lower_variable_index_to_cond_assign.cpp \
|
||||
lower_vec_index_to_cond_assign.cpp \
|
||||
lower_vec_index_to_swizzle.cpp \
|
||||
lower_vector.cpp \
|
||||
lower_vector_derefs.cpp \
|
||||
lower_vector_insert.cpp \
|
||||
lower_vertex_id.cpp \
|
||||
lower_output_reads.cpp \
|
||||
lower_shared_reference.cpp \
|
||||
lower_ubo_reference.cpp \
|
||||
opt_algebraic.cpp \
|
||||
opt_array_splitting.cpp \
|
||||
opt_conditional_discard.cpp \
|
||||
opt_constant_folding.cpp \
|
||||
opt_constant_propagation.cpp \
|
||||
opt_constant_variable.cpp \
|
||||
opt_copy_propagation.cpp \
|
||||
opt_copy_propagation_elements.cpp \
|
||||
opt_dead_builtin_variables.cpp \
|
||||
opt_dead_builtin_varyings.cpp \
|
||||
opt_dead_code.cpp \
|
||||
opt_dead_code_local.cpp \
|
||||
opt_dead_functions.cpp \
|
||||
opt_flatten_nested_if_blocks.cpp \
|
||||
opt_flip_matrices.cpp \
|
||||
opt_function_inlining.cpp \
|
||||
opt_if_simplification.cpp \
|
||||
opt_minmax.cpp \
|
||||
opt_noop_swizzle.cpp \
|
||||
opt_rebalance_tree.cpp \
|
||||
opt_redundant_jumps.cpp \
|
||||
opt_structure_splitting.cpp \
|
||||
opt_swizzle_swizzle.cpp \
|
||||
opt_tree_grafting.cpp \
|
||||
opt_vectorize.cpp \
|
||||
program.h \
|
||||
propagate_invariance.cpp \
|
||||
s_expression.cpp \
|
||||
s_expression.h
|
||||
|
||||
# glsl to nir pass
|
||||
GLSL_TO_NIR_FILES = \
|
||||
nir/glsl_to_nir.cpp \
|
||||
nir/glsl_to_nir.h
|
||||
|
||||
# glsl_compiler
|
||||
|
||||
GLSL_COMPILER_CXX_FILES = \
|
||||
standalone_scaffolding.cpp \
|
||||
standalone_scaffolding.h \
|
||||
main.cpp
|
||||
|
||||
# libglsl generated sources
|
||||
LIBGLSL_GENERATED_CXX_FILES = \
|
||||
glsl_lexer.cpp \
|
||||
glsl_parser.cpp
|
||||
|
|
@ -736,6 +736,11 @@ struct ast_type_qualifier {
|
|||
const ast_type_qualifier &q,
|
||||
ast_node* &node, bool create_node);
|
||||
|
||||
bool validate_flags(YYLTYPE *loc,
|
||||
_mesa_glsl_parse_state *state,
|
||||
const char *message,
|
||||
const ast_type_qualifier &allowed_flags);
|
||||
|
||||
ast_subroutine_list *subroutine_list;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4300,6 +4300,17 @@ ast_declarator_list::hir(exec_list *instructions,
|
|||
state->atomic_counter_offsets[qual_binding] = qual_offset;
|
||||
}
|
||||
}
|
||||
|
||||
ast_type_qualifier allowed_atomic_qual_mask;
|
||||
allowed_atomic_qual_mask.flags.i = 0;
|
||||
allowed_atomic_qual_mask.flags.q.explicit_binding = 1;
|
||||
allowed_atomic_qual_mask.flags.q.explicit_offset = 1;
|
||||
allowed_atomic_qual_mask.flags.q.uniform = 1;
|
||||
|
||||
type->qualifier.validate_flags(&loc, state,
|
||||
"invalid layout qualifier for "
|
||||
"atomic_uint",
|
||||
allowed_atomic_qual_mask);
|
||||
}
|
||||
|
||||
if (this->declarations.is_empty()) {
|
||||
|
|
|
|||
|
|
@ -581,6 +581,91 @@ ast_type_qualifier::merge_in_qualifier(YYLTYPE *loc,
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the current type qualifier has any illegal flags.
|
||||
*
|
||||
* If so, print an error message, followed by a list of illegal flags.
|
||||
*
|
||||
* \param message The error message to print.
|
||||
* \param allowed_flags A list of valid flags.
|
||||
*/
|
||||
bool
|
||||
ast_type_qualifier::validate_flags(YYLTYPE *loc,
|
||||
_mesa_glsl_parse_state *state,
|
||||
const char *message,
|
||||
const ast_type_qualifier &allowed_flags)
|
||||
{
|
||||
ast_type_qualifier bad;
|
||||
bad.flags.i = this->flags.i & ~allowed_flags.flags.i;
|
||||
if (bad.flags.i == 0)
|
||||
return true;
|
||||
|
||||
_mesa_glsl_error(loc, state,
|
||||
"%s:"
|
||||
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
|
||||
"%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s"
|
||||
"%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||
message,
|
||||
bad.flags.q.invariant ? " invariant" : "",
|
||||
bad.flags.q.precise ? " precise" : "",
|
||||
bad.flags.q.constant ? " constant" : "",
|
||||
bad.flags.q.attribute ? " attribute" : "",
|
||||
bad.flags.q.varying ? " varying" : "",
|
||||
bad.flags.q.in ? " in" : "",
|
||||
bad.flags.q.out ? " out" : "",
|
||||
bad.flags.q.centroid ? " centroid" : "",
|
||||
bad.flags.q.sample ? " sample" : "",
|
||||
bad.flags.q.patch ? " patch" : "",
|
||||
bad.flags.q.uniform ? " uniform" : "",
|
||||
bad.flags.q.buffer ? " buffer" : "",
|
||||
bad.flags.q.shared_storage ? " shared_storage" : "",
|
||||
bad.flags.q.smooth ? " smooth" : "",
|
||||
bad.flags.q.flat ? " flat" : "",
|
||||
bad.flags.q.noperspective ? " noperspective" : "",
|
||||
bad.flags.q.origin_upper_left ? " origin_upper_left" : "",
|
||||
bad.flags.q.pixel_center_integer ? " pixel_center_integer" : "",
|
||||
bad.flags.q.explicit_align ? " align" : "",
|
||||
bad.flags.q.explicit_location ? " location" : "",
|
||||
bad.flags.q.explicit_index ? " index" : "",
|
||||
bad.flags.q.explicit_binding ? " binding" : "",
|
||||
bad.flags.q.explicit_offset ? " offset" : "",
|
||||
bad.flags.q.depth_any ? " depth_any" : "",
|
||||
bad.flags.q.depth_greater ? " depth_greater" : "",
|
||||
bad.flags.q.depth_less ? " depth_less" : "",
|
||||
bad.flags.q.depth_unchanged ? " depth_unchanged" : "",
|
||||
bad.flags.q.std140 ? " std140" : "",
|
||||
bad.flags.q.std430 ? " std430" : "",
|
||||
bad.flags.q.shared ? " shared" : "",
|
||||
bad.flags.q.packed ? " packed" : "",
|
||||
bad.flags.q.column_major ? " column_major" : "",
|
||||
bad.flags.q.row_major ? " row_major" : "",
|
||||
bad.flags.q.prim_type ? " prim_type" : "",
|
||||
bad.flags.q.max_vertices ? " max_vertices" : "",
|
||||
bad.flags.q.local_size ? " local_size" : "",
|
||||
bad.flags.q.early_fragment_tests ? " early_fragment_tests" : "",
|
||||
bad.flags.q.explicit_image_format ? " image_format" : "",
|
||||
bad.flags.q.coherent ? " coherent" : "",
|
||||
bad.flags.q._volatile ? " _volatile" : "",
|
||||
bad.flags.q.restrict_flag ? " restrict_flag" : "",
|
||||
bad.flags.q.read_only ? " read_only" : "",
|
||||
bad.flags.q.write_only ? " write_only" : "",
|
||||
bad.flags.q.invocations ? " invocations" : "",
|
||||
bad.flags.q.stream ? " stream" : "",
|
||||
bad.flags.q.explicit_stream ? " stream" : "",
|
||||
bad.flags.q.explicit_xfb_offset ? " xfb_offset" : "",
|
||||
bad.flags.q.xfb_buffer ? " xfb_buffer" : "",
|
||||
bad.flags.q.explicit_xfb_buffer ? " xfb_buffer" : "",
|
||||
bad.flags.q.xfb_stride ? " xfb_stride" : "",
|
||||
bad.flags.q.explicit_xfb_stride ? " xfb_stride" : "",
|
||||
bad.flags.q.vertex_spacing ? " vertex_spacing" : "",
|
||||
bad.flags.q.ordering ? " ordering" : "",
|
||||
bad.flags.q.point_mode ? " point_mode" : "",
|
||||
bad.flags.q.vertices ? " vertices" : "",
|
||||
bad.flags.q.subroutine ? " subroutine" : "",
|
||||
bad.flags.q.subroutine_def ? " subroutine_def" : "");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
ast_layout_expression::process_qualifier_constant(struct _mesa_glsl_parse_state *state,
|
||||
const char *qual_indentifier,
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ in return IN_TOK;
|
|||
out return OUT_TOK;
|
||||
inout return INOUT_TOK;
|
||||
uniform return UNIFORM;
|
||||
buffer return BUFFER;
|
||||
buffer KEYWORD_WITH_ALT(0, 0, 430, 310, yyextra->ARB_shader_storage_buffer_object_enable, BUFFER);
|
||||
varying DEPRECATED_ES_KEYWORD(VARYING);
|
||||
centroid KEYWORD(120, 300, 120, 300, CENTROID);
|
||||
invariant KEYWORD(120, 100, 120, 100, INVARIANT);
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ void
|
|||
ir_set_program_inouts_visitor::mark_whole_variable(ir_variable *var)
|
||||
{
|
||||
const glsl_type *type = var->type;
|
||||
bool vertex_input = false;
|
||||
bool is_vertex_input = false;
|
||||
if (this->shader_stage == MESA_SHADER_GEOMETRY &&
|
||||
var->data.mode == ir_var_shader_in && type->is_array()) {
|
||||
type = type->fields.array;
|
||||
|
|
@ -175,9 +175,9 @@ ir_set_program_inouts_visitor::mark_whole_variable(ir_variable *var)
|
|||
|
||||
if (this->shader_stage == MESA_SHADER_VERTEX &&
|
||||
var->data.mode == ir_var_shader_in)
|
||||
vertex_input = true;
|
||||
is_vertex_input = true;
|
||||
|
||||
mark(this->prog, var, 0, type->count_attribute_slots(vertex_input),
|
||||
mark(this->prog, var, 0, type->count_attribute_slots(is_vertex_input),
|
||||
this->shader_stage);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -488,7 +488,7 @@ remove_unused_shader_inputs_and_outputs(bool is_separate_shader_object,
|
|||
* its value is used by other shader stages. This will cause the
|
||||
* variable to have a location assigned.
|
||||
*/
|
||||
if (var->data.is_unmatched_generic_inout) {
|
||||
if (var->data.is_unmatched_generic_inout && !var->data.is_xfb_only) {
|
||||
assert(var->data.mode != ir_var_temporary);
|
||||
var->data.mode = ir_var_auto;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2618,7 +2618,7 @@ assign_attribute_or_color_locations(gl_shader_program *prog,
|
|||
return false;
|
||||
}
|
||||
|
||||
const unsigned slots = var->type->count_attribute_slots(target_index == MESA_SHADER_VERTEX ? true : false);
|
||||
const unsigned slots = var->type->count_attribute_slots(target_index == MESA_SHADER_VERTEX);
|
||||
|
||||
/* If the variable is not a built-in and has a location statically
|
||||
* assigned in the shader (presumably via a layout qualifier), make sure
|
||||
|
|
@ -3249,12 +3249,12 @@ reserve_subroutine_explicit_locations(struct gl_shader_program *prog,
|
|||
* any optimizations happen to handle also inactive uniforms and
|
||||
* inactive array elements that may get trimmed away.
|
||||
*/
|
||||
static int
|
||||
static unsigned
|
||||
check_explicit_uniform_locations(struct gl_context *ctx,
|
||||
struct gl_shader_program *prog)
|
||||
{
|
||||
if (!ctx->Extensions.ARB_explicit_uniform_location)
|
||||
return -1;
|
||||
return 0;
|
||||
|
||||
/* This map is used to detect if overlapping explicit locations
|
||||
* occur with the same uniform (from different stage) or a different one.
|
||||
|
|
@ -3263,7 +3263,7 @@ check_explicit_uniform_locations(struct gl_context *ctx,
|
|||
|
||||
if (!uniform_map) {
|
||||
linker_error(prog, "Out of memory during linking.\n");
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned entries_total = 0;
|
||||
|
|
@ -3292,7 +3292,7 @@ check_explicit_uniform_locations(struct gl_context *ctx,
|
|||
}
|
||||
if (!ret) {
|
||||
delete uniform_map;
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3518,8 +3518,9 @@ build_stageref(struct gl_shader_program *shProg, const char *name,
|
|||
*/
|
||||
static gl_shader_variable *
|
||||
create_shader_variable(struct gl_shader_program *shProg,
|
||||
const ir_variable *in, bool use_implicit_location,
|
||||
int location_bias)
|
||||
const ir_variable *in,
|
||||
const char *name, const glsl_type *type,
|
||||
bool use_implicit_location, int location)
|
||||
{
|
||||
gl_shader_variable *out = ralloc(shProg, struct gl_shader_variable);
|
||||
if (!out)
|
||||
|
|
@ -3532,7 +3533,7 @@ create_shader_variable(struct gl_shader_program *shProg,
|
|||
in->data.location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) {
|
||||
out->name = ralloc_strdup(shProg, "gl_VertexID");
|
||||
} else {
|
||||
out->name = ralloc_strdup(shProg, in->name);
|
||||
out->name = ralloc_strdup(shProg, name);
|
||||
}
|
||||
|
||||
if (!out->name)
|
||||
|
|
@ -3557,10 +3558,10 @@ create_shader_variable(struct gl_shader_program *shProg,
|
|||
!(in->data.explicit_location || use_implicit_location)) {
|
||||
out->location = -1;
|
||||
} else {
|
||||
out->location = in->data.location - location_bias;
|
||||
out->location = location;
|
||||
}
|
||||
|
||||
out->type = in->type;
|
||||
out->type = type;
|
||||
out->index = in->data.index;
|
||||
out->patch = in->data.patch;
|
||||
out->mode = in->data.mode;
|
||||
|
|
@ -3568,6 +3569,60 @@ create_shader_variable(struct gl_shader_program *shProg,
|
|||
return out;
|
||||
}
|
||||
|
||||
static bool
|
||||
add_shader_variable(struct gl_shader_program *shProg, unsigned stage_mask,
|
||||
GLenum programInterface, ir_variable *var,
|
||||
const char *name, const glsl_type *type,
|
||||
bool use_implicit_location, int location)
|
||||
{
|
||||
const bool is_vertex_input =
|
||||
programInterface == GL_PROGRAM_INPUT &&
|
||||
stage_mask == MESA_SHADER_VERTEX;
|
||||
|
||||
switch (type->base_type) {
|
||||
case GLSL_TYPE_STRUCT: {
|
||||
/* From the ARB_program_interface_query specification:
|
||||
*
|
||||
* "For an active variable declared as a structure, a separate entry
|
||||
* will be generated for each active structure member. The name of
|
||||
* each entry is formed by concatenating the name of the structure,
|
||||
* the "." character, and the name of the structure member. If a
|
||||
* structure member to enumerate is itself a structure or array, these
|
||||
* enumeration rules are applied recursively."
|
||||
*/
|
||||
unsigned field_location = location;
|
||||
for (unsigned i = 0; i < type->length; i++) {
|
||||
const struct glsl_struct_field *field = &type->fields.structure[i];
|
||||
char *field_name = ralloc_asprintf(shProg, "%s.%s", name, field->name);
|
||||
if (!add_shader_variable(shProg, stage_mask, programInterface,
|
||||
var, field_name, field->type,
|
||||
use_implicit_location, field_location))
|
||||
return false;
|
||||
|
||||
field_location +=
|
||||
field->type->count_attribute_slots(is_vertex_input);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
default: {
|
||||
/* From the ARB_program_interface_query specification:
|
||||
*
|
||||
* "For an active variable declared as a single instance of a basic
|
||||
* type, a single entry will be generated, using the variable name
|
||||
* from the shader source."
|
||||
*/
|
||||
gl_shader_variable *sha_v =
|
||||
create_shader_variable(shProg, var, name, type,
|
||||
use_implicit_location, location);
|
||||
if (!sha_v)
|
||||
return false;
|
||||
|
||||
return add_program_resource(shProg, programInterface, sha_v, stage_mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
add_interface_variables(struct gl_shader_program *shProg,
|
||||
unsigned stage, GLenum programInterface)
|
||||
|
|
@ -3616,12 +3671,9 @@ add_interface_variables(struct gl_shader_program *shProg,
|
|||
(stage == MESA_SHADER_VERTEX && var->data.mode == ir_var_shader_in) ||
|
||||
(stage == MESA_SHADER_FRAGMENT && var->data.mode == ir_var_shader_out);
|
||||
|
||||
gl_shader_variable *sha_v =
|
||||
create_shader_variable(shProg, var, vs_input_or_fs_output, loc_bias);
|
||||
if (!sha_v)
|
||||
return false;
|
||||
|
||||
if (!add_program_resource(shProg, programInterface, sha_v, 1 << stage))
|
||||
if (!add_shader_variable(shProg, 1 << stage, programInterface,
|
||||
var, var->name, var->type, vs_input_or_fs_output,
|
||||
var->data.location - loc_bias))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
@ -3651,13 +3703,11 @@ add_packed_varyings(struct gl_shader_program *shProg, int stage, GLenum type)
|
|||
}
|
||||
|
||||
if (type == iface) {
|
||||
gl_shader_variable *sha_v =
|
||||
create_shader_variable(shProg, var, false, VARYING_SLOT_VAR0);
|
||||
if (!sha_v)
|
||||
return false;
|
||||
if (!add_program_resource(shProg, iface, sha_v,
|
||||
build_stageref(shProg, sha_v->name,
|
||||
sha_v->mode)))
|
||||
const int stage_mask =
|
||||
build_stageref(shProg, var->name, var->data.mode);
|
||||
if (!add_shader_variable(shProg, stage_mask,
|
||||
iface, var, var->name, var->type, false,
|
||||
var->data.location - VARYING_SLOT_VAR0))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -3677,12 +3727,11 @@ add_fragdata_arrays(struct gl_shader_program *shProg)
|
|||
ir_variable *var = node->as_variable();
|
||||
if (var) {
|
||||
assert(var->data.mode == ir_var_shader_out);
|
||||
gl_shader_variable *sha_v =
|
||||
create_shader_variable(shProg, var, true, FRAG_RESULT_DATA0);
|
||||
if (!sha_v)
|
||||
return false;
|
||||
if (!add_program_resource(shProg, GL_PROGRAM_OUTPUT, sha_v,
|
||||
1 << MESA_SHADER_FRAGMENT))
|
||||
|
||||
if (!add_shader_variable(shProg,
|
||||
1 << MESA_SHADER_FRAGMENT,
|
||||
GL_PROGRAM_OUTPUT, var, var->name, var->type,
|
||||
true, var->data.location - FRAG_RESULT_DATA0))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,7 +122,7 @@ public:
|
|||
exec_list *acp;
|
||||
|
||||
/**
|
||||
* List of kill_entry: The masks of variables whose values were
|
||||
* Hash table of kill_entry: The masks of variables whose values were
|
||||
* killed in this block.
|
||||
*/
|
||||
hash_table *kills;
|
||||
|
|
@ -454,7 +454,7 @@ ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask)
|
|||
}
|
||||
}
|
||||
|
||||
/* Add this writemask of the variable to the list of killed
|
||||
/* Add this writemask of the variable to the hash table of killed
|
||||
* variables in this block.
|
||||
*/
|
||||
hash_entry *kill_hash_entry = _mesa_hash_table_search(this->kills, var);
|
||||
|
|
@ -463,7 +463,7 @@ ir_constant_propagation_visitor::kill(ir_variable *var, unsigned write_mask)
|
|||
entry->write_mask |= write_mask;
|
||||
return;
|
||||
}
|
||||
/* Not already in the list. Make new entry. */
|
||||
/* Not already in the hash table. Make new entry. */
|
||||
_mesa_hash_table_insert(this->kills, var,
|
||||
new(this->mem_ctx) kill_entry(var, write_mask));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -331,7 +331,8 @@ ir_copy_propagation_visitor::add_copy(ir_assignment *ir)
|
|||
ir->condition = new(ralloc_parent(ir)) ir_constant(false);
|
||||
this->progress = true;
|
||||
} else if (lhs_var->data.mode != ir_var_shader_storage &&
|
||||
lhs_var->data.mode != ir_var_shader_shared) {
|
||||
lhs_var->data.mode != ir_var_shader_shared &&
|
||||
lhs_var->data.precise == rhs_var->data.precise) {
|
||||
entry = new(this->acp) acp_entry(lhs_var, rhs_var);
|
||||
this->acp->push_tail(entry);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -493,6 +493,9 @@ ir_copy_propagation_elements_visitor::add_copy(ir_assignment *ir)
|
|||
}
|
||||
}
|
||||
|
||||
if (lhs->var->data.precise != rhs->var->data.precise)
|
||||
return;
|
||||
|
||||
entry = new(this->mem_ctx) acp_entry(lhs->var, rhs->var, write_mask,
|
||||
swizzle);
|
||||
this->acp->push_tail(entry);
|
||||
|
|
|
|||
|
|
@ -368,6 +368,9 @@ tree_grafting_basic_block(ir_instruction *bb_first,
|
|||
lhs_var->data.mode == ir_var_shader_shared)
|
||||
continue;
|
||||
|
||||
if (lhs_var->data.precise)
|
||||
continue;
|
||||
|
||||
ir_variable_refcount_entry *entry = info->refs->get_variable_entry(lhs_var);
|
||||
|
||||
if (!entry->declaration ||
|
||||
|
|
|
|||
|
|
@ -1897,7 +1897,7 @@ glsl_type::std430_size(bool row_major) const
|
|||
}
|
||||
|
||||
unsigned
|
||||
glsl_type::count_attribute_slots(bool vertex_input_slots) const
|
||||
glsl_type::count_attribute_slots(bool is_vertex_input) const
|
||||
{
|
||||
/* From page 31 (page 37 of the PDF) of the GLSL 1.50 spec:
|
||||
*
|
||||
|
|
@ -1931,7 +1931,7 @@ glsl_type::count_attribute_slots(bool vertex_input_slots) const
|
|||
case GLSL_TYPE_BOOL:
|
||||
return this->matrix_columns;
|
||||
case GLSL_TYPE_DOUBLE:
|
||||
if (this->vector_elements > 2 && !vertex_input_slots)
|
||||
if (this->vector_elements > 2 && !is_vertex_input)
|
||||
return this->matrix_columns * 2;
|
||||
else
|
||||
return this->matrix_columns;
|
||||
|
|
@ -1940,13 +1940,13 @@ glsl_type::count_attribute_slots(bool vertex_input_slots) const
|
|||
unsigned size = 0;
|
||||
|
||||
for (unsigned i = 0; i < this->length; i++)
|
||||
size += this->fields.structure[i].type->count_attribute_slots(vertex_input_slots);
|
||||
size += this->fields.structure[i].type->count_attribute_slots(is_vertex_input);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
case GLSL_TYPE_ARRAY:
|
||||
return this->length * this->fields.array->count_attribute_slots(vertex_input_slots);
|
||||
return this->length * this->fields.array->count_attribute_slots(is_vertex_input);
|
||||
|
||||
case GLSL_TYPE_FUNCTION:
|
||||
case GLSL_TYPE_SAMPLER:
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ struct glsl_type {
|
|||
* For vertex shader attributes - doubles only take one slot.
|
||||
* For inter-shader varyings - dvec3/dvec4 take two slots.
|
||||
*/
|
||||
unsigned count_attribute_slots(bool vertex_input_slots) const;
|
||||
unsigned count_attribute_slots(bool is_vertex_input) const;
|
||||
|
||||
/**
|
||||
* Alignment in bytes of the start of this type in a std140 uniform
|
||||
|
|
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
NIR_GENERATED_FILES = \
|
||||
nir_builder_opcodes.h \
|
||||
nir_constant_expressions.c \
|
||||
nir_opcodes.c \
|
||||
nir_opcodes.h \
|
||||
nir_opt_algebraic.c
|
||||
|
||||
NIR_FILES = \
|
||||
glsl_to_nir.cpp \
|
||||
glsl_to_nir.h \
|
||||
nir.c \
|
||||
nir.h \
|
||||
nir_array.h \
|
||||
nir_builder.h \
|
||||
nir_clone.c \
|
||||
nir_constant_expressions.h \
|
||||
nir_control_flow.c \
|
||||
nir_control_flow.h \
|
||||
nir_control_flow_private.h \
|
||||
nir_dominance.c \
|
||||
nir_from_ssa.c \
|
||||
nir_gather_info.c \
|
||||
nir_gs_count_vertices.c \
|
||||
nir_inline_functions.c \
|
||||
nir_instr_set.c \
|
||||
nir_instr_set.h \
|
||||
nir_intrinsics.c \
|
||||
nir_intrinsics.h \
|
||||
nir_liveness.c \
|
||||
nir_lower_alu_to_scalar.c \
|
||||
nir_lower_atomics.c \
|
||||
nir_lower_clip.c \
|
||||
nir_lower_global_vars_to_local.c \
|
||||
nir_lower_gs_intrinsics.c \
|
||||
nir_lower_load_const_to_scalar.c \
|
||||
nir_lower_locals_to_regs.c \
|
||||
nir_lower_idiv.c \
|
||||
nir_lower_indirect_derefs.c \
|
||||
nir_lower_io.c \
|
||||
nir_lower_outputs_to_temporaries.c \
|
||||
nir_lower_phis_to_scalar.c \
|
||||
nir_lower_returns.c \
|
||||
nir_lower_samplers.c \
|
||||
nir_lower_system_values.c \
|
||||
nir_lower_tex.c \
|
||||
nir_lower_to_source_mods.c \
|
||||
nir_lower_two_sided_color.c \
|
||||
nir_lower_vars_to_ssa.c \
|
||||
nir_lower_var_copies.c \
|
||||
nir_lower_vec_to_movs.c \
|
||||
nir_metadata.c \
|
||||
nir_move_vec_src_uses_to_dest.c \
|
||||
nir_normalize_cubemap_coords.c \
|
||||
nir_opt_constant_folding.c \
|
||||
nir_opt_copy_propagate.c \
|
||||
nir_opt_cse.c \
|
||||
nir_opt_dce.c \
|
||||
nir_opt_dead_cf.c \
|
||||
nir_opt_gcm.c \
|
||||
nir_opt_global_to_local.c \
|
||||
nir_opt_peephole_select.c \
|
||||
nir_opt_remove_phis.c \
|
||||
nir_opt_undef.c \
|
||||
nir_phi_builder.c \
|
||||
nir_phi_builder.h \
|
||||
nir_print.c \
|
||||
nir_remove_dead_variables.c \
|
||||
nir_repair_ssa.c \
|
||||
nir_search.c \
|
||||
nir_search.h \
|
||||
nir_split_var_copies.c \
|
||||
nir_sweep.c \
|
||||
nir_to_ssa.c \
|
||||
nir_validate.c \
|
||||
nir_vla.h \
|
||||
nir_worklist.c \
|
||||
nir_worklist.h
|
||||
|
||||
SPIRV_FILES = \
|
||||
spirv/nir_spirv.h \
|
||||
spirv/spirv_to_nir.c \
|
||||
spirv/vtn_alu.c \
|
||||
spirv/vtn_cfg.c \
|
||||
spirv/vtn_glsl450.c \
|
||||
spirv/vtn_private.h \
|
||||
spirv/vtn_variables.c
|
||||
|
||||
|
|
@ -73,7 +73,7 @@ public:
|
|||
void create_function(ir_function_signature *ir);
|
||||
|
||||
private:
|
||||
void add_instr(nir_instr *instr, unsigned num_components);
|
||||
void add_instr(nir_instr *instr, unsigned num_components, unsigned bit_size);
|
||||
nir_ssa_def *evaluate_rvalue(ir_rvalue *ir);
|
||||
|
||||
nir_alu_instr *emit(nir_op op, unsigned dest_size, nir_ssa_def **srcs);
|
||||
|
|
@ -257,6 +257,11 @@ constant_copy(ir_constant *ir, void *mem_ctx)
|
|||
ret->value.f[i] = ir->value.f[i];
|
||||
break;
|
||||
|
||||
case GLSL_TYPE_DOUBLE:
|
||||
for (i = 0; i < total_elems; i++)
|
||||
ret->value.d[i] = ir->value.d[i];
|
||||
break;
|
||||
|
||||
case GLSL_TYPE_BOOL:
|
||||
for (i = 0; i < total_elems; i++)
|
||||
ret->value.b[i] = ir->value.b[i];
|
||||
|
|
@ -736,7 +741,7 @@ nir_visitor::visit(ir_call *ir)
|
|||
case nir_intrinsic_image_samples:
|
||||
case nir_intrinsic_image_size: {
|
||||
nir_ssa_undef_instr *instr_undef =
|
||||
nir_ssa_undef_instr_create(shader, 1);
|
||||
nir_ssa_undef_instr_create(shader, 1, 32);
|
||||
nir_builder_instr_insert(&b, &instr_undef->instr);
|
||||
|
||||
/* Set the image variable dereference. */
|
||||
|
|
@ -854,8 +859,9 @@ nir_visitor::visit(ir_call *ir)
|
|||
instr->num_components = type->vector_elements;
|
||||
|
||||
/* Setup destination register */
|
||||
unsigned bit_size = glsl_get_bit_size(type->base_type);
|
||||
nir_ssa_dest_init(&instr->instr, &instr->dest,
|
||||
type->vector_elements, 32, NULL);
|
||||
type->vector_elements, bit_size, NULL);
|
||||
|
||||
/* Insert the created nir instruction now since in the case of boolean
|
||||
* result we will need to emit another instruction after it
|
||||
|
|
@ -878,7 +884,7 @@ nir_visitor::visit(ir_call *ir)
|
|||
load_ssbo_compare->src[1].swizzle[i] = 0;
|
||||
nir_ssa_dest_init(&load_ssbo_compare->instr,
|
||||
&load_ssbo_compare->dest.dest,
|
||||
type->vector_elements, 32, NULL);
|
||||
type->vector_elements, bit_size, NULL);
|
||||
load_ssbo_compare->dest.write_mask = (1 << type->vector_elements) - 1;
|
||||
nir_builder_instr_insert(&b, &load_ssbo_compare->instr);
|
||||
dest = &load_ssbo_compare->dest.dest;
|
||||
|
|
@ -1152,12 +1158,13 @@ get_instr_dest(nir_instr *instr)
|
|||
}
|
||||
|
||||
void
|
||||
nir_visitor::add_instr(nir_instr *instr, unsigned num_components)
|
||||
nir_visitor::add_instr(nir_instr *instr, unsigned num_components,
|
||||
unsigned bit_size)
|
||||
{
|
||||
nir_dest *dest = get_instr_dest(instr);
|
||||
|
||||
if (dest)
|
||||
nir_ssa_dest_init(instr, dest, num_components, 32, NULL);
|
||||
nir_ssa_dest_init(instr, dest, num_components, bit_size, NULL);
|
||||
|
||||
nir_builder_instr_insert(&b, instr);
|
||||
|
||||
|
|
@ -1182,12 +1189,19 @@ nir_visitor::evaluate_rvalue(ir_rvalue* ir)
|
|||
load_instr->num_components = ir->type->vector_elements;
|
||||
load_instr->variables[0] = this->deref_head;
|
||||
ralloc_steal(load_instr, load_instr->variables[0]);
|
||||
add_instr(&load_instr->instr, ir->type->vector_elements);
|
||||
unsigned bit_size = glsl_get_bit_size(ir->type->base_type);
|
||||
add_instr(&load_instr->instr, ir->type->vector_elements, bit_size);
|
||||
}
|
||||
|
||||
return this->result;
|
||||
}
|
||||
|
||||
static bool
|
||||
type_is_float(glsl_base_type type)
|
||||
{
|
||||
return type == GLSL_TYPE_FLOAT || type == GLSL_TYPE_DOUBLE;
|
||||
}
|
||||
|
||||
void
|
||||
nir_visitor::visit(ir_expression *ir)
|
||||
{
|
||||
|
|
@ -1196,11 +1210,11 @@ nir_visitor::visit(ir_expression *ir)
|
|||
case ir_binop_ubo_load: {
|
||||
nir_intrinsic_instr *load =
|
||||
nir_intrinsic_instr_create(this->shader, nir_intrinsic_load_ubo);
|
||||
unsigned bit_size = glsl_get_bit_size(ir->type->base_type);
|
||||
load->num_components = ir->type->vector_elements;
|
||||
load->dest.ssa.bit_size = glsl_get_bit_size(ir->type->base_type);
|
||||
load->src[0] = nir_src_for_ssa(evaluate_rvalue(ir->operands[0]));
|
||||
load->src[1] = nir_src_for_ssa(evaluate_rvalue(ir->operands[1]));
|
||||
add_instr(&load->instr, ir->type->vector_elements);
|
||||
add_instr(&load->instr, ir->type->vector_elements, bit_size);
|
||||
|
||||
/*
|
||||
* In UBO's, a true boolean value is any non-zero value, but we consider
|
||||
|
|
@ -1265,7 +1279,8 @@ nir_visitor::visit(ir_expression *ir)
|
|||
intrin->intrinsic == nir_intrinsic_interp_var_at_sample)
|
||||
intrin->src[0] = nir_src_for_ssa(evaluate_rvalue(ir->operands[1]));
|
||||
|
||||
add_instr(&intrin->instr, deref->type->vector_elements);
|
||||
unsigned bit_size = glsl_get_bit_size(deref->type->base_type);
|
||||
add_instr(&intrin->instr, deref->type->vector_elements, bit_size);
|
||||
|
||||
if (swizzle) {
|
||||
unsigned swiz[4] = {
|
||||
|
|
@ -1306,20 +1321,20 @@ nir_visitor::visit(ir_expression *ir)
|
|||
result = supports_ints ? nir_inot(&b, srcs[0]) : nir_fnot(&b, srcs[0]);
|
||||
break;
|
||||
case ir_unop_neg:
|
||||
result = (types[0] == GLSL_TYPE_FLOAT) ? nir_fneg(&b, srcs[0])
|
||||
: nir_ineg(&b, srcs[0]);
|
||||
result = type_is_float(types[0]) ? nir_fneg(&b, srcs[0])
|
||||
: nir_ineg(&b, srcs[0]);
|
||||
break;
|
||||
case ir_unop_abs:
|
||||
result = (types[0] == GLSL_TYPE_FLOAT) ? nir_fabs(&b, srcs[0])
|
||||
: nir_iabs(&b, srcs[0]);
|
||||
result = type_is_float(types[0]) ? nir_fabs(&b, srcs[0])
|
||||
: nir_iabs(&b, srcs[0]);
|
||||
break;
|
||||
case ir_unop_saturate:
|
||||
assert(types[0] == GLSL_TYPE_FLOAT);
|
||||
assert(type_is_float(types[0]));
|
||||
result = nir_fsat(&b, srcs[0]);
|
||||
break;
|
||||
case ir_unop_sign:
|
||||
result = (types[0] == GLSL_TYPE_FLOAT) ? nir_fsign(&b, srcs[0])
|
||||
: nir_isign(&b, srcs[0]);
|
||||
result = type_is_float(types[0]) ? nir_fsign(&b, srcs[0])
|
||||
: nir_isign(&b, srcs[0]);
|
||||
break;
|
||||
case ir_unop_rcp: result = nir_frcp(&b, srcs[0]); break;
|
||||
case ir_unop_rsq: result = nir_frsq(&b, srcs[0]); break;
|
||||
|
|
@ -1342,6 +1357,19 @@ nir_visitor::visit(ir_expression *ir)
|
|||
case ir_unop_f2b: result = nir_f2b(&b, srcs[0]); break;
|
||||
case ir_unop_i2b: result = nir_i2b(&b, srcs[0]); break;
|
||||
case ir_unop_b2i: result = nir_b2i(&b, srcs[0]); break;
|
||||
case ir_unop_d2f: result = nir_d2f(&b, srcs[0]); break;
|
||||
case ir_unop_f2d: result = nir_f2d(&b, srcs[0]); break;
|
||||
case ir_unop_d2i: result = nir_d2i(&b, srcs[0]); break;
|
||||
case ir_unop_d2u: result = nir_d2u(&b, srcs[0]); break;
|
||||
case ir_unop_d2b: result = nir_d2b(&b, srcs[0]); break;
|
||||
case ir_unop_i2d:
|
||||
assert(supports_ints);
|
||||
result = nir_i2d(&b, srcs[0]);
|
||||
break;
|
||||
case ir_unop_u2d:
|
||||
assert(supports_ints);
|
||||
result = nir_u2d(&b, srcs[0]);
|
||||
break;
|
||||
case ir_unop_i2u:
|
||||
case ir_unop_u2i:
|
||||
case ir_unop_bitcast_i2f:
|
||||
|
|
@ -1395,6 +1423,12 @@ nir_visitor::visit(ir_expression *ir)
|
|||
case ir_unop_unpack_half_2x16:
|
||||
result = nir_unpack_half_2x16(&b, srcs[0]);
|
||||
break;
|
||||
case ir_unop_pack_double_2x32:
|
||||
result = nir_pack_double_2x32(&b, srcs[0]);
|
||||
break;
|
||||
case ir_unop_unpack_double_2x32:
|
||||
result = nir_unpack_double_2x32(&b, srcs[0]);
|
||||
break;
|
||||
case ir_unop_bitfield_reverse:
|
||||
result = nir_bitfield_reverse(&b, srcs[0]);
|
||||
break;
|
||||
|
|
@ -1465,24 +1499,25 @@ nir_visitor::visit(ir_expression *ir)
|
|||
nir_intrinsic_get_buffer_size);
|
||||
load->num_components = ir->type->vector_elements;
|
||||
load->src[0] = nir_src_for_ssa(evaluate_rvalue(ir->operands[0]));
|
||||
add_instr(&load->instr, ir->type->vector_elements);
|
||||
unsigned bit_size = glsl_get_bit_size(ir->type->base_type);
|
||||
add_instr(&load->instr, ir->type->vector_elements, bit_size);
|
||||
return;
|
||||
}
|
||||
|
||||
case ir_binop_add:
|
||||
result = (out_type == GLSL_TYPE_FLOAT) ? nir_fadd(&b, srcs[0], srcs[1])
|
||||
: nir_iadd(&b, srcs[0], srcs[1]);
|
||||
result = type_is_float(out_type) ? nir_fadd(&b, srcs[0], srcs[1])
|
||||
: nir_iadd(&b, srcs[0], srcs[1]);
|
||||
break;
|
||||
case ir_binop_sub:
|
||||
result = (out_type == GLSL_TYPE_FLOAT) ? nir_fsub(&b, srcs[0], srcs[1])
|
||||
: nir_isub(&b, srcs[0], srcs[1]);
|
||||
result = type_is_float(out_type) ? nir_fsub(&b, srcs[0], srcs[1])
|
||||
: nir_isub(&b, srcs[0], srcs[1]);
|
||||
break;
|
||||
case ir_binop_mul:
|
||||
result = (out_type == GLSL_TYPE_FLOAT) ? nir_fmul(&b, srcs[0], srcs[1])
|
||||
: nir_imul(&b, srcs[0], srcs[1]);
|
||||
result = type_is_float(out_type) ? nir_fmul(&b, srcs[0], srcs[1])
|
||||
: nir_imul(&b, srcs[0], srcs[1]);
|
||||
break;
|
||||
case ir_binop_div:
|
||||
if (out_type == GLSL_TYPE_FLOAT)
|
||||
if (type_is_float(out_type))
|
||||
result = nir_fdiv(&b, srcs[0], srcs[1]);
|
||||
else if (out_type == GLSL_TYPE_INT)
|
||||
result = nir_idiv(&b, srcs[0], srcs[1]);
|
||||
|
|
@ -1490,11 +1525,11 @@ nir_visitor::visit(ir_expression *ir)
|
|||
result = nir_udiv(&b, srcs[0], srcs[1]);
|
||||
break;
|
||||
case ir_binop_mod:
|
||||
result = (out_type == GLSL_TYPE_FLOAT) ? nir_fmod(&b, srcs[0], srcs[1])
|
||||
: nir_umod(&b, srcs[0], srcs[1]);
|
||||
result = type_is_float(out_type) ? nir_fmod(&b, srcs[0], srcs[1])
|
||||
: nir_umod(&b, srcs[0], srcs[1]);
|
||||
break;
|
||||
case ir_binop_min:
|
||||
if (out_type == GLSL_TYPE_FLOAT)
|
||||
if (type_is_float(out_type))
|
||||
result = nir_fmin(&b, srcs[0], srcs[1]);
|
||||
else if (out_type == GLSL_TYPE_INT)
|
||||
result = nir_imin(&b, srcs[0], srcs[1]);
|
||||
|
|
@ -1502,7 +1537,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
result = nir_umin(&b, srcs[0], srcs[1]);
|
||||
break;
|
||||
case ir_binop_max:
|
||||
if (out_type == GLSL_TYPE_FLOAT)
|
||||
if (type_is_float(out_type))
|
||||
result = nir_fmax(&b, srcs[0], srcs[1]);
|
||||
else if (out_type == GLSL_TYPE_INT)
|
||||
result = nir_imax(&b, srcs[0], srcs[1]);
|
||||
|
|
@ -1538,7 +1573,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
case ir_binop_borrow: result = nir_usub_borrow(&b, srcs[0], srcs[1]); break;
|
||||
case ir_binop_less:
|
||||
if (supports_ints) {
|
||||
if (types[0] == GLSL_TYPE_FLOAT)
|
||||
if (type_is_float(types[0]))
|
||||
result = nir_flt(&b, srcs[0], srcs[1]);
|
||||
else if (types[0] == GLSL_TYPE_INT)
|
||||
result = nir_ilt(&b, srcs[0], srcs[1]);
|
||||
|
|
@ -1550,7 +1585,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
break;
|
||||
case ir_binop_greater:
|
||||
if (supports_ints) {
|
||||
if (types[0] == GLSL_TYPE_FLOAT)
|
||||
if (type_is_float(types[0]))
|
||||
result = nir_flt(&b, srcs[1], srcs[0]);
|
||||
else if (types[0] == GLSL_TYPE_INT)
|
||||
result = nir_ilt(&b, srcs[1], srcs[0]);
|
||||
|
|
@ -1562,7 +1597,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
break;
|
||||
case ir_binop_lequal:
|
||||
if (supports_ints) {
|
||||
if (types[0] == GLSL_TYPE_FLOAT)
|
||||
if (type_is_float(types[0]))
|
||||
result = nir_fge(&b, srcs[1], srcs[0]);
|
||||
else if (types[0] == GLSL_TYPE_INT)
|
||||
result = nir_ige(&b, srcs[1], srcs[0]);
|
||||
|
|
@ -1574,7 +1609,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
break;
|
||||
case ir_binop_gequal:
|
||||
if (supports_ints) {
|
||||
if (types[0] == GLSL_TYPE_FLOAT)
|
||||
if (type_is_float(types[0]))
|
||||
result = nir_fge(&b, srcs[0], srcs[1]);
|
||||
else if (types[0] == GLSL_TYPE_INT)
|
||||
result = nir_ige(&b, srcs[0], srcs[1]);
|
||||
|
|
@ -1586,7 +1621,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
break;
|
||||
case ir_binop_equal:
|
||||
if (supports_ints) {
|
||||
if (types[0] == GLSL_TYPE_FLOAT)
|
||||
if (type_is_float(types[0]))
|
||||
result = nir_feq(&b, srcs[0], srcs[1]);
|
||||
else
|
||||
result = nir_ieq(&b, srcs[0], srcs[1]);
|
||||
|
|
@ -1596,7 +1631,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
break;
|
||||
case ir_binop_nequal:
|
||||
if (supports_ints) {
|
||||
if (types[0] == GLSL_TYPE_FLOAT)
|
||||
if (type_is_float(types[0]))
|
||||
result = nir_fne(&b, srcs[0], srcs[1]);
|
||||
else
|
||||
result = nir_ine(&b, srcs[0], srcs[1]);
|
||||
|
|
@ -1606,7 +1641,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
break;
|
||||
case ir_binop_all_equal:
|
||||
if (supports_ints) {
|
||||
if (types[0] == GLSL_TYPE_FLOAT) {
|
||||
if (type_is_float(types[0])) {
|
||||
switch (ir->operands[0]->type->vector_elements) {
|
||||
case 1: result = nir_feq(&b, srcs[0], srcs[1]); break;
|
||||
case 2: result = nir_ball_fequal2(&b, srcs[0], srcs[1]); break;
|
||||
|
|
@ -1638,7 +1673,7 @@ nir_visitor::visit(ir_expression *ir)
|
|||
break;
|
||||
case ir_binop_any_nequal:
|
||||
if (supports_ints) {
|
||||
if (types[0] == GLSL_TYPE_FLOAT) {
|
||||
if (type_is_float(types[0])) {
|
||||
switch (ir->operands[0]->type->vector_elements) {
|
||||
case 1: result = nir_fne(&b, srcs[0], srcs[1]); break;
|
||||
case 2: result = nir_bany_fnequal2(&b, srcs[0], srcs[1]); break;
|
||||
|
|
@ -1902,7 +1937,8 @@ nir_visitor::visit(ir_texture *ir)
|
|||
|
||||
assert(src_number == num_srcs);
|
||||
|
||||
add_instr(&instr->instr, nir_tex_instr_dest_size(instr));
|
||||
unsigned bit_size = glsl_get_bit_size(ir->type->base_type);
|
||||
add_instr(&instr->instr, nir_tex_instr_dest_size(instr), bit_size);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
|
|
@ -469,12 +469,13 @@ nir_jump_instr_create(nir_shader *shader, nir_jump_type type)
|
|||
}
|
||||
|
||||
nir_load_const_instr *
|
||||
nir_load_const_instr_create(nir_shader *shader, unsigned num_components)
|
||||
nir_load_const_instr_create(nir_shader *shader, unsigned num_components,
|
||||
unsigned bit_size)
|
||||
{
|
||||
nir_load_const_instr *instr = ralloc(shader, nir_load_const_instr);
|
||||
instr_init(&instr->instr, nir_instr_type_load_const);
|
||||
|
||||
nir_ssa_def_init(&instr->instr, &instr->def, num_components, 32, NULL);
|
||||
nir_ssa_def_init(&instr->instr, &instr->def, num_components, bit_size, NULL);
|
||||
|
||||
return instr;
|
||||
}
|
||||
|
|
@ -558,12 +559,14 @@ nir_parallel_copy_instr_create(nir_shader *shader)
|
|||
}
|
||||
|
||||
nir_ssa_undef_instr *
|
||||
nir_ssa_undef_instr_create(nir_shader *shader, unsigned num_components)
|
||||
nir_ssa_undef_instr_create(nir_shader *shader,
|
||||
unsigned num_components,
|
||||
unsigned bit_size)
|
||||
{
|
||||
nir_ssa_undef_instr *instr = ralloc(shader, nir_ssa_undef_instr);
|
||||
instr_init(&instr->instr, nir_instr_type_ssa_undef);
|
||||
|
||||
nir_ssa_def_init(&instr->instr, &instr->def, num_components, 32, NULL);
|
||||
nir_ssa_def_init(&instr->instr, &instr->def, num_components, bit_size, NULL);
|
||||
|
||||
return instr;
|
||||
}
|
||||
|
|
@ -691,8 +694,10 @@ nir_deref_get_const_initializer_load(nir_shader *shader, nir_deref_var *deref)
|
|||
tail = tail->child;
|
||||
}
|
||||
|
||||
unsigned bit_size = glsl_get_bit_size(glsl_get_base_type(tail->type));
|
||||
nir_load_const_instr *load =
|
||||
nir_load_const_instr_create(shader, glsl_get_vector_elements(tail->type));
|
||||
nir_load_const_instr_create(shader, glsl_get_vector_elements(tail->type),
|
||||
bit_size);
|
||||
|
||||
matrix_offset *= load->def.num_components;
|
||||
for (unsigned i = 0; i < load->def.num_components; i++) {
|
||||
|
|
@ -702,6 +707,9 @@ nir_deref_get_const_initializer_load(nir_shader *shader, nir_deref_var *deref)
|
|||
case GLSL_TYPE_UINT:
|
||||
load->value.u32[i] = constant->value.u[matrix_offset + i];
|
||||
break;
|
||||
case GLSL_TYPE_DOUBLE:
|
||||
load->value.f64[i] = constant->value.d[matrix_offset + i];
|
||||
break;
|
||||
case GLSL_TYPE_BOOL:
|
||||
load->value.u32[i] = constant->value.b[matrix_offset + i] ?
|
||||
NIR_TRUE : NIR_FALSE;
|
||||
|
|
|
|||
|
|
@ -81,16 +81,16 @@ typedef struct {
|
|||
} nir_state_slot;
|
||||
|
||||
typedef enum {
|
||||
nir_var_all = -1,
|
||||
nir_var_shader_in,
|
||||
nir_var_shader_out,
|
||||
nir_var_global,
|
||||
nir_var_local,
|
||||
nir_var_uniform,
|
||||
nir_var_shader_storage,
|
||||
nir_var_system_value,
|
||||
nir_var_param,
|
||||
nir_var_shared,
|
||||
nir_var_shader_in = (1 << 0),
|
||||
nir_var_shader_out = (1 << 1),
|
||||
nir_var_global = (1 << 2),
|
||||
nir_var_local = (1 << 3),
|
||||
nir_var_uniform = (1 << 4),
|
||||
nir_var_shader_storage = (1 << 5),
|
||||
nir_var_system_value = (1 << 6),
|
||||
nir_var_param = (1 << 7),
|
||||
nir_var_shared = (1 << 8),
|
||||
nir_var_all = ~0,
|
||||
} nir_variable_mode;
|
||||
|
||||
/**
|
||||
|
|
@ -156,6 +156,12 @@ typedef struct nir_variable {
|
|||
char *name;
|
||||
|
||||
struct nir_variable_data {
|
||||
/**
|
||||
* Storage class of the variable.
|
||||
*
|
||||
* \sa nir_variable_mode
|
||||
*/
|
||||
nir_variable_mode mode;
|
||||
|
||||
/**
|
||||
* Is the variable read-only?
|
||||
|
|
@ -169,13 +175,6 @@ typedef struct nir_variable {
|
|||
unsigned patch:1;
|
||||
unsigned invariant:1;
|
||||
|
||||
/**
|
||||
* Storage class of the variable.
|
||||
*
|
||||
* \sa nir_variable_mode
|
||||
*/
|
||||
nir_variable_mode mode:5;
|
||||
|
||||
/**
|
||||
* Interpolation mode for shader inputs / outputs
|
||||
*
|
||||
|
|
@ -1857,7 +1856,8 @@ nir_alu_instr *nir_alu_instr_create(nir_shader *shader, nir_op op);
|
|||
nir_jump_instr *nir_jump_instr_create(nir_shader *shader, nir_jump_type type);
|
||||
|
||||
nir_load_const_instr *nir_load_const_instr_create(nir_shader *shader,
|
||||
unsigned num_components);
|
||||
unsigned num_components,
|
||||
unsigned bit_size);
|
||||
|
||||
nir_intrinsic_instr *nir_intrinsic_instr_create(nir_shader *shader,
|
||||
nir_intrinsic_op op);
|
||||
|
|
@ -1872,7 +1872,8 @@ nir_phi_instr *nir_phi_instr_create(nir_shader *shader);
|
|||
nir_parallel_copy_instr *nir_parallel_copy_instr_create(nir_shader *shader);
|
||||
|
||||
nir_ssa_undef_instr *nir_ssa_undef_instr_create(nir_shader *shader,
|
||||
unsigned num_components);
|
||||
unsigned num_components,
|
||||
unsigned bit_size);
|
||||
|
||||
nir_deref_var *nir_deref_var_create(void *mem_ctx, nir_variable *var);
|
||||
nir_deref_array *nir_deref_array_create(void *mem_ctx);
|
||||
|
|
@ -2208,12 +2209,13 @@ void nir_lower_var_copies(nir_shader *shader);
|
|||
|
||||
bool nir_lower_global_vars_to_local(nir_shader *shader);
|
||||
|
||||
bool nir_lower_indirect_derefs(nir_shader *shader, uint32_t mode_mask);
|
||||
bool nir_lower_indirect_derefs(nir_shader *shader, nir_variable_mode modes);
|
||||
|
||||
bool nir_lower_locals_to_regs(nir_shader *shader);
|
||||
|
||||
void nir_lower_outputs_to_temporaries(nir_shader *shader,
|
||||
nir_function *entrypoint);
|
||||
void nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint);
|
||||
|
||||
void nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint);
|
||||
|
||||
|
|
@ -2222,14 +2224,14 @@ void nir_assign_var_locations(struct exec_list *var_list,
|
|||
int (*type_size)(const struct glsl_type *));
|
||||
|
||||
void nir_lower_io(nir_shader *shader,
|
||||
nir_variable_mode mode,
|
||||
nir_variable_mode modes,
|
||||
int (*type_size)(const struct glsl_type *));
|
||||
nir_src *nir_get_io_offset_src(nir_intrinsic_instr *instr);
|
||||
nir_src *nir_get_io_vertex_index_src(nir_intrinsic_instr *instr);
|
||||
|
||||
void nir_lower_vars_to_ssa(nir_shader *shader);
|
||||
|
||||
bool nir_remove_dead_variables(nir_shader *shader, nir_variable_mode mode);
|
||||
bool nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes);
|
||||
|
||||
void nir_move_vec_src_uses_to_dest(nir_shader *shader);
|
||||
bool nir_lower_vec_to_movs(nir_shader *shader);
|
||||
|
|
@ -2305,6 +2307,8 @@ void nir_lower_to_source_mods(nir_shader *shader);
|
|||
|
||||
bool nir_lower_gs_intrinsics(nir_shader *shader);
|
||||
|
||||
void nir_lower_double_pack(nir_shader *shader);
|
||||
|
||||
bool nir_normalize_cubemap_coords(nir_shader *shader);
|
||||
|
||||
void nir_live_ssa_defs_impl(nir_function_impl *impl);
|
||||
|
|
|
|||
|
|
@ -291,6 +291,7 @@ ${pass_name}(nir_shader *shader)
|
|||
bool progress = false;
|
||||
bool condition_flags[${len(condition_list)}];
|
||||
const nir_shader_compiler_options *options = shader->options;
|
||||
(void) options;
|
||||
|
||||
% for index, condition in enumerate(condition_list):
|
||||
condition_flags[${index}] = ${condition};
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ static inline nir_ssa_def *
|
|||
nir_ssa_undef(nir_builder *build, unsigned num_components, unsigned bit_size)
|
||||
{
|
||||
nir_ssa_undef_instr *undef =
|
||||
nir_ssa_undef_instr_create(build->shader, num_components);
|
||||
nir_ssa_undef_instr_create(build->shader, num_components, bit_size);
|
||||
undef->def.bit_size = bit_size;
|
||||
if (!undef)
|
||||
return NULL;
|
||||
|
|
@ -92,7 +92,7 @@ static inline nir_ssa_def *
|
|||
nir_build_imm(nir_builder *build, unsigned num_components, nir_const_value value)
|
||||
{
|
||||
nir_load_const_instr *load_const =
|
||||
nir_load_const_instr_create(build->shader, num_components);
|
||||
nir_load_const_instr_create(build->shader, num_components, 32);
|
||||
if (!load_const)
|
||||
return NULL;
|
||||
|
||||
|
|
|
|||
|
|
@ -179,6 +179,7 @@ clone_register(clone_state *state, const nir_register *reg)
|
|||
add_remap(state, nreg, reg);
|
||||
|
||||
nreg->num_components = reg->num_components;
|
||||
nreg->bit_size = reg->bit_size;
|
||||
nreg->num_array_elems = reg->num_array_elems;
|
||||
nreg->index = reg->index;
|
||||
nreg->name = ralloc_strdup(nreg, reg->name);
|
||||
|
|
@ -359,7 +360,8 @@ static nir_load_const_instr *
|
|||
clone_load_const(clone_state *state, const nir_load_const_instr *lc)
|
||||
{
|
||||
nir_load_const_instr *nlc =
|
||||
nir_load_const_instr_create(state->ns, lc->def.num_components);
|
||||
nir_load_const_instr_create(state->ns, lc->def.num_components,
|
||||
lc->def.bit_size);
|
||||
|
||||
memcpy(&nlc->value, &lc->value, sizeof(nlc->value));
|
||||
|
||||
|
|
@ -372,7 +374,8 @@ static nir_ssa_undef_instr *
|
|||
clone_ssa_undef(clone_state *state, const nir_ssa_undef_instr *sa)
|
||||
{
|
||||
nir_ssa_undef_instr *nsa =
|
||||
nir_ssa_undef_instr_create(state->ns, sa->def.num_components);
|
||||
nir_ssa_undef_instr_create(state->ns, sa->def.num_components,
|
||||
sa->def.bit_size);
|
||||
|
||||
add_remap(state, &nsa->def, &sa->def);
|
||||
|
||||
|
|
|
|||
|
|
@ -281,7 +281,8 @@ insert_phi_undef(nir_block *block, nir_block *pred)
|
|||
nir_phi_instr *phi = nir_instr_as_phi(instr);
|
||||
nir_ssa_undef_instr *undef =
|
||||
nir_ssa_undef_instr_create(ralloc_parent(phi),
|
||||
phi->dest.ssa.num_components);
|
||||
phi->dest.ssa.num_components,
|
||||
phi->dest.ssa.bit_size);
|
||||
nir_instr_insert_before_cf_list(&impl->body, &undef->instr);
|
||||
nir_phi_src *src = ralloc(phi, nir_phi_src);
|
||||
src->pred = pred;
|
||||
|
|
@ -691,7 +692,8 @@ replace_ssa_def_uses(nir_ssa_def *def, void *void_impl)
|
|||
void *mem_ctx = ralloc_parent(impl);
|
||||
|
||||
nir_ssa_undef_instr *undef =
|
||||
nir_ssa_undef_instr_create(mem_ctx, def->num_components);
|
||||
nir_ssa_undef_instr_create(mem_ctx, def->num_components,
|
||||
def->bit_size);
|
||||
nir_instr_insert_before_cf_list(&impl->body, &undef->instr);
|
||||
nir_ssa_def_rewrite_uses(def, nir_src_for_ssa(&undef->def));
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -474,6 +474,7 @@ rewrite_ssa_def(nir_ssa_def *def, void *void_state)
|
|||
node->set->reg = nir_local_reg_create(state->impl);
|
||||
node->set->reg->name = def->name;
|
||||
node->set->reg->num_components = def->num_components;
|
||||
node->set->reg->bit_size = def->bit_size;
|
||||
node->set->reg->num_array_elems = 0;
|
||||
}
|
||||
|
||||
|
|
@ -491,6 +492,7 @@ rewrite_ssa_def(nir_ssa_def *def, void *void_state)
|
|||
reg = nir_local_reg_create(state->impl);
|
||||
reg->name = def->name;
|
||||
reg->num_components = def->num_components;
|
||||
reg->bit_size = def->bit_size;
|
||||
reg->num_array_elems = 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ hash_alu(uint32_t hash, const nir_alu_instr *instr)
|
|||
{
|
||||
hash = HASH(hash, instr->op);
|
||||
hash = HASH(hash, instr->dest.dest.ssa.num_components);
|
||||
hash = HASH(hash, instr->dest.dest.ssa.bit_size);
|
||||
/* We explicitly don't hash instr->dest.dest.exact */
|
||||
|
||||
if (nir_op_infos[instr->op].algebraic_properties & NIR_OP_IS_COMMUTATIVE) {
|
||||
|
|
@ -82,9 +83,8 @@ hash_load_const(uint32_t hash, const nir_load_const_instr *instr)
|
|||
{
|
||||
hash = HASH(hash, instr->def.num_components);
|
||||
|
||||
hash = _mesa_fnv32_1a_accumulate_block(hash, instr->value.f32,
|
||||
instr->def.num_components
|
||||
* sizeof(instr->value.f32[0]));
|
||||
unsigned size = instr->def.num_components * (instr->def.bit_size / 8);
|
||||
hash = _mesa_fnv32_1a_accumulate_block(hash, instr->value.f32, size);
|
||||
|
||||
return hash;
|
||||
}
|
||||
|
|
@ -126,8 +126,10 @@ hash_intrinsic(uint32_t hash, const nir_intrinsic_instr *instr)
|
|||
const nir_intrinsic_info *info = &nir_intrinsic_infos[instr->intrinsic];
|
||||
hash = HASH(hash, instr->intrinsic);
|
||||
|
||||
if (info->has_dest)
|
||||
if (info->has_dest) {
|
||||
hash = HASH(hash, instr->dest.ssa.num_components);
|
||||
hash = HASH(hash, instr->dest.ssa.bit_size);
|
||||
}
|
||||
|
||||
assert(info->num_variables == 0);
|
||||
|
||||
|
|
@ -268,6 +270,9 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2)
|
|||
if (alu1->dest.dest.ssa.num_components != alu2->dest.dest.ssa.num_components)
|
||||
return false;
|
||||
|
||||
if (alu1->dest.dest.ssa.bit_size != alu2->dest.dest.ssa.bit_size)
|
||||
return false;
|
||||
|
||||
/* We explicitly don't hash instr->dest.dest.exact */
|
||||
|
||||
if (nir_op_infos[alu1->op].algebraic_properties & NIR_OP_IS_COMMUTATIVE) {
|
||||
|
|
@ -325,8 +330,11 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2)
|
|||
if (load1->def.num_components != load2->def.num_components)
|
||||
return false;
|
||||
|
||||
if (load1->def.bit_size != load2->def.bit_size)
|
||||
return false;
|
||||
|
||||
return memcmp(load1->value.f32, load2->value.f32,
|
||||
load1->def.num_components * sizeof(*load2->value.f32)) == 0;
|
||||
load1->def.num_components * (load1->def.bit_size / 8)) == 0;
|
||||
}
|
||||
case nir_instr_type_phi: {
|
||||
nir_phi_instr *phi1 = nir_instr_as_phi(instr1);
|
||||
|
|
@ -362,6 +370,10 @@ nir_instrs_equal(const nir_instr *instr1, const nir_instr *instr2)
|
|||
intrinsic2->dest.ssa.num_components)
|
||||
return false;
|
||||
|
||||
if (info->has_dest && intrinsic1->dest.ssa.bit_size !=
|
||||
intrinsic2->dest.ssa.bit_size)
|
||||
return false;
|
||||
|
||||
for (unsigned i = 0; i < info->num_srcs; i++) {
|
||||
if (!nir_srcs_equal(intrinsic1->src[i], intrinsic2->src[i]))
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -187,6 +187,9 @@ lower_alu_instr_scalar(nir_alu_instr *instr, nir_builder *b)
|
|||
return;
|
||||
}
|
||||
|
||||
case nir_op_unpack_double_2x32:
|
||||
return;
|
||||
|
||||
LOWER_REDUCTION(nir_op_fdot, nir_op_fmul, nir_op_fadd);
|
||||
LOWER_REDUCTION(nir_op_ball_fequal, nir_op_feq, nir_op_iand);
|
||||
LOWER_REDUCTION(nir_op_ball_iequal, nir_op_ieq, nir_op_iand);
|
||||
|
|
|
|||
|
|
@ -74,7 +74,8 @@ lower_instr(nir_intrinsic_instr *instr,
|
|||
nir_intrinsic_set_base(new_instr,
|
||||
state->shader_program->UniformStorage[uniform_loc].opaque[state->shader->stage].index);
|
||||
|
||||
nir_load_const_instr *offset_const = nir_load_const_instr_create(mem_ctx, 1);
|
||||
nir_load_const_instr *offset_const =
|
||||
nir_load_const_instr_create(mem_ctx, 1, 32);
|
||||
offset_const->value.u32[0] = instr->variables[0]->var->data.offset;
|
||||
|
||||
nir_instr_insert_before(&instr->instr, &offset_const->instr);
|
||||
|
|
@ -95,7 +96,7 @@ lower_instr(nir_intrinsic_instr *instr,
|
|||
|
||||
if (deref_array->deref_array_type == nir_deref_array_type_indirect) {
|
||||
nir_load_const_instr *atomic_counter_size =
|
||||
nir_load_const_instr_create(mem_ctx, 1);
|
||||
nir_load_const_instr_create(mem_ctx, 1, 32);
|
||||
atomic_counter_size->value.u32[0] = child_array_elements * ATOMIC_COUNTER_SIZE;
|
||||
nir_instr_insert_before(&instr->instr, &atomic_counter_size->instr);
|
||||
|
||||
|
|
|
|||
95
src/compiler/nir/nir_lower_double_packing.c
Normal file
95
src/compiler/nir/nir_lower_double_packing.c
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
/*
|
||||
* Copyright © 2015 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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "nir.h"
|
||||
#include "nir_builder.h"
|
||||
|
||||
/*
|
||||
* lowers:
|
||||
*
|
||||
* packDouble2x32(foo) -> packDouble2x32Split(foo.x, foo.y)
|
||||
* unpackDouble2x32(foo) -> vec2(unpackDouble2x32_x(foo), unpackDouble2x32_y(foo))
|
||||
*/
|
||||
|
||||
static nir_ssa_def *
|
||||
lower_pack_double(nir_builder *b, nir_ssa_def *src)
|
||||
{
|
||||
return nir_pack_double_2x32_split(b, nir_channel(b, src, 0),
|
||||
nir_channel(b, src, 1));
|
||||
}
|
||||
|
||||
static nir_ssa_def *
|
||||
lower_unpack_double(nir_builder *b, nir_ssa_def *src)
|
||||
{
|
||||
return nir_vec2(b, nir_unpack_double_2x32_split_x(b, src),
|
||||
nir_unpack_double_2x32_split_y(b, src));
|
||||
}
|
||||
|
||||
static bool
|
||||
lower_double_pack_block(nir_block *block, void *ctx)
|
||||
{
|
||||
nir_builder *b = (nir_builder *) ctx;
|
||||
|
||||
nir_foreach_instr_safe(block, instr) {
|
||||
if (instr->type != nir_instr_type_alu)
|
||||
continue;
|
||||
|
||||
nir_alu_instr *alu_instr = (nir_alu_instr *) instr;
|
||||
|
||||
if (alu_instr->op != nir_op_pack_double_2x32 &&
|
||||
alu_instr->op != nir_op_unpack_double_2x32)
|
||||
continue;
|
||||
|
||||
b->cursor = nir_before_instr(&alu_instr->instr);
|
||||
|
||||
nir_ssa_def *src = nir_ssa_for_alu_src(b, alu_instr, 0);
|
||||
nir_ssa_def *dest =
|
||||
alu_instr->op == nir_op_pack_double_2x32 ?
|
||||
lower_pack_double(b, src) :
|
||||
lower_unpack_double(b, src);
|
||||
|
||||
nir_ssa_def_rewrite_uses(&alu_instr->dest.dest.ssa, nir_src_for_ssa(dest));
|
||||
nir_instr_remove(&alu_instr->instr);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
lower_double_pack_impl(nir_function_impl *impl)
|
||||
{
|
||||
nir_builder b;
|
||||
nir_builder_init(&b, impl);
|
||||
nir_foreach_block(impl, lower_double_pack_block, &b);
|
||||
}
|
||||
|
||||
void
|
||||
nir_lower_double_pack(nir_shader *shader)
|
||||
{
|
||||
nir_foreach_function(shader, function) {
|
||||
if (function->impl)
|
||||
lower_double_pack_impl(function->impl);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -161,7 +161,7 @@ deref_has_indirect(nir_deref_var *deref)
|
|||
|
||||
struct lower_indirect_state {
|
||||
nir_builder builder;
|
||||
uint32_t mode_mask;
|
||||
nir_variable_mode modes;
|
||||
bool progress;
|
||||
};
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ lower_indirect_block(nir_block *block, void *void_state)
|
|||
continue;
|
||||
|
||||
/* Only lower variables whose mode is in the mask */
|
||||
if (!(state->mode_mask & (1 << intrin->variables[0]->var->data.mode)))
|
||||
if (!(state->modes & intrin->variables[0]->var->data.mode))
|
||||
continue;
|
||||
|
||||
state->builder.cursor = nir_before_instr(&intrin->instr);
|
||||
|
|
@ -206,12 +206,12 @@ lower_indirect_block(nir_block *block, void *void_state)
|
|||
}
|
||||
|
||||
static bool
|
||||
lower_indirects_impl(nir_function_impl *impl, uint32_t mode_mask)
|
||||
lower_indirects_impl(nir_function_impl *impl, nir_variable_mode modes)
|
||||
{
|
||||
struct lower_indirect_state state;
|
||||
|
||||
state.progress = false;
|
||||
state.mode_mask = mode_mask;
|
||||
state.modes = modes;
|
||||
nir_builder_init(&state.builder, impl);
|
||||
|
||||
nir_foreach_block(impl, lower_indirect_block, &state);
|
||||
|
|
@ -228,13 +228,13 @@ lower_indirects_impl(nir_function_impl *impl, uint32_t mode_mask)
|
|||
* that does a binary search on the array index.
|
||||
*/
|
||||
bool
|
||||
nir_lower_indirect_derefs(nir_shader *shader, uint32_t mode_mask)
|
||||
nir_lower_indirect_derefs(nir_shader *shader, nir_variable_mode modes)
|
||||
{
|
||||
bool progress = false;
|
||||
|
||||
nir_foreach_function(shader, function) {
|
||||
if (function->impl)
|
||||
progress = lower_indirects_impl(function->impl, mode_mask) || progress;
|
||||
progress = lower_indirects_impl(function->impl, modes) || progress;
|
||||
}
|
||||
|
||||
return progress;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ struct lower_io_state {
|
|||
nir_builder builder;
|
||||
void *mem_ctx;
|
||||
int (*type_size)(const struct glsl_type *type);
|
||||
nir_variable_mode mode;
|
||||
nir_variable_mode modes;
|
||||
};
|
||||
|
||||
void
|
||||
|
|
@ -245,7 +245,7 @@ nir_lower_io_block(nir_block *block, void *void_state)
|
|||
|
||||
nir_variable_mode mode = intrin->variables[0]->var->data.mode;
|
||||
|
||||
if (state->mode != nir_var_all && state->mode != mode)
|
||||
if ((state->modes & mode) == 0)
|
||||
continue;
|
||||
|
||||
if (mode != nir_var_shader_in &&
|
||||
|
|
@ -393,14 +393,14 @@ nir_lower_io_block(nir_block *block, void *void_state)
|
|||
|
||||
static void
|
||||
nir_lower_io_impl(nir_function_impl *impl,
|
||||
nir_variable_mode mode,
|
||||
nir_variable_mode modes,
|
||||
int (*type_size)(const struct glsl_type *))
|
||||
{
|
||||
struct lower_io_state state;
|
||||
|
||||
nir_builder_init(&state.builder, impl);
|
||||
state.mem_ctx = ralloc_parent(impl);
|
||||
state.mode = mode;
|
||||
state.modes = modes;
|
||||
state.type_size = type_size;
|
||||
|
||||
nir_foreach_block(impl, nir_lower_io_block, &state);
|
||||
|
|
@ -410,12 +410,12 @@ nir_lower_io_impl(nir_function_impl *impl,
|
|||
}
|
||||
|
||||
void
|
||||
nir_lower_io(nir_shader *shader, nir_variable_mode mode,
|
||||
nir_lower_io(nir_shader *shader, nir_variable_mode modes,
|
||||
int (*type_size)(const struct glsl_type *))
|
||||
{
|
||||
nir_foreach_function(shader, function) {
|
||||
if (function->impl)
|
||||
nir_lower_io_impl(function->impl, mode, type_size);
|
||||
nir_lower_io_impl(function->impl, modes, type_size);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,8 +48,13 @@ lower_load_const_instr_scalar(nir_load_const_instr *lower)
|
|||
/* Emit the individual loads. */
|
||||
nir_ssa_def *loads[4];
|
||||
for (unsigned i = 0; i < lower->def.num_components; i++) {
|
||||
nir_load_const_instr *load_comp = nir_load_const_instr_create(b.shader, 1);
|
||||
load_comp->value.u32[0] = lower->value.u32[i];
|
||||
nir_load_const_instr *load_comp =
|
||||
nir_load_const_instr_create(b.shader, 1, lower->def.bit_size);
|
||||
if (lower->def.bit_size == 64)
|
||||
load_comp->value.f64[0] = lower->value.f64[i];
|
||||
else
|
||||
load_comp->value.u32[0] = lower->value.u32[i];
|
||||
assert(lower->def.bit_size == 64 || lower->def.bit_size == 32);
|
||||
nir_builder_instr_insert(&b, &load_comp->instr);
|
||||
loads[i] = &load_comp->def;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ get_reg_for_deref(nir_deref_var *deref, struct locals_to_regs_state *state)
|
|||
nir_register *reg = nir_local_reg_create(state->impl);
|
||||
reg->num_components = glsl_get_vector_elements(tail->type);
|
||||
reg->num_array_elems = array_size > 1 ? array_size : 0;
|
||||
reg->bit_size = glsl_get_bit_size(glsl_get_base_type(tail->type));
|
||||
|
||||
_mesa_hash_table_insert_pre_hashed(state->regs_table, hash, deref, reg);
|
||||
nir_array_add(&state->derefs_array, nir_deref_var *, deref);
|
||||
|
|
@ -160,7 +161,7 @@ get_deref_reg_src(nir_deref_var *deref, nir_instr *instr,
|
|||
|
||||
if (src.reg.indirect) {
|
||||
nir_load_const_instr *load_const =
|
||||
nir_load_const_instr_create(state->shader, 1);
|
||||
nir_load_const_instr_create(state->shader, 1, 32);
|
||||
load_const->value.u32[0] = glsl_get_length(parent_type);
|
||||
nir_instr_insert_before(instr, &load_const->instr);
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ nir_lower_to_source_mods_block(nir_block *block, void *state)
|
|||
if (parent->dest.saturate)
|
||||
continue;
|
||||
|
||||
switch (nir_op_infos[alu->op].input_types[i]) {
|
||||
switch (nir_alu_type_get_base_type(nir_op_infos[alu->op].input_types[i])) {
|
||||
case nir_type_float:
|
||||
if (parent->op != nir_op_fmov)
|
||||
continue;
|
||||
|
|
@ -128,7 +128,8 @@ nir_lower_to_source_mods_block(nir_block *block, void *state)
|
|||
continue;
|
||||
|
||||
/* We can only saturate float destinations */
|
||||
if (nir_op_infos[alu->op].output_type != nir_type_float)
|
||||
if (nir_alu_type_get_base_type(nir_op_infos[alu->op].output_type) !=
|
||||
nir_type_float)
|
||||
continue;
|
||||
|
||||
if (!list_empty(&alu->dest.dest.ssa.if_uses))
|
||||
|
|
|
|||
|
|
@ -504,8 +504,8 @@ rename_variables_block(nir_block *block, struct lower_variables_state *state)
|
|||
*/
|
||||
nir_ssa_undef_instr *undef =
|
||||
nir_ssa_undef_instr_create(state->shader,
|
||||
intrin->num_components);
|
||||
undef->def.bit_size = intrin->dest.ssa.bit_size;
|
||||
intrin->num_components,
|
||||
intrin->dest.ssa.bit_size);
|
||||
|
||||
nir_instr_insert_before(&intrin->instr, &undef->instr);
|
||||
nir_instr_remove(&intrin->instr);
|
||||
|
|
|
|||
|
|
@ -240,6 +240,7 @@ lower_vec_to_movs_block(nir_block *block, void *void_state)
|
|||
/* Since we insert multiple MOVs, we have a register destination. */
|
||||
nir_register *reg = nir_local_reg_create(impl);
|
||||
reg->num_components = vec->dest.dest.ssa.num_components;
|
||||
reg->bit_size = vec->dest.dest.ssa.bit_size;
|
||||
|
||||
nir_ssa_def_rewrite_uses(&vec->dest.dest.ssa, nir_src_for_reg(reg));
|
||||
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ tuint = "uint"
|
|||
tfloat32 = "float32"
|
||||
tint32 = "int32"
|
||||
tuint32 = "uint32"
|
||||
tuint64 = "uint64"
|
||||
tfloat64 = "float64"
|
||||
|
||||
commutative = "commutative "
|
||||
|
|
@ -161,15 +162,23 @@ unop("fexp2", tfloat, "exp2f(src0)")
|
|||
unop("flog2", tfloat, "log2f(src0)")
|
||||
unop_convert("f2i", tint32, tfloat32, "src0") # Float-to-integer conversion.
|
||||
unop_convert("f2u", tuint32, tfloat32, "src0") # Float-to-unsigned conversion
|
||||
unop_convert("d2i", tint32, tfloat64, "src0") # Double-to-integer conversion.
|
||||
unop_convert("d2u", tuint32, tfloat64, "src0") # Double-to-unsigned conversion.
|
||||
unop_convert("i2f", tfloat32, tint32, "src0") # Integer-to-float conversion.
|
||||
unop_convert("i2d", tfloat64, tint32, "src0") # Integer-to-double conversion.
|
||||
# Float-to-boolean conversion
|
||||
unop_convert("f2b", tbool, tfloat32, "src0 != 0.0f")
|
||||
unop_convert("d2b", tbool, tfloat64, "src0 != 0.0")
|
||||
# Boolean-to-float conversion
|
||||
unop_convert("b2f", tfloat32, tbool, "src0 ? 1.0f : 0.0f")
|
||||
# Int-to-boolean conversion
|
||||
unop_convert("i2b", tbool, tint32, "src0 != 0")
|
||||
unop_convert("b2i", tint32, tbool, "src0 ? 1 : 0") # Boolean-to-int conversion
|
||||
unop_convert("u2f", tfloat32, tuint32, "src0") # Unsigned-to-float conversion.
|
||||
unop_convert("u2d", tfloat64, tuint32, "src0") # Unsigned-to-double conversion.
|
||||
# double-to-float conversion
|
||||
unop_convert("d2f", tfloat32, tfloat64, "src0") # Single to double precision
|
||||
unop_convert("f2d", tfloat64, tfloat32, "src0") # Double to single precision
|
||||
|
||||
# Unary floating-point rounding operations.
|
||||
|
||||
|
|
@ -253,6 +262,34 @@ dst.x = (src0.x << 0) |
|
|||
(src0.w << 24);
|
||||
""")
|
||||
|
||||
unop_horiz("pack_double_2x32", 1, tuint64, 2, tuint32, """
|
||||
union {
|
||||
uint64_t u64;
|
||||
struct {
|
||||
uint32_t i1;
|
||||
uint32_t i2;
|
||||
};
|
||||
} di;
|
||||
|
||||
di.i1 = src0.x;
|
||||
di.i2 = src0.y;
|
||||
dst.x = di.u64;
|
||||
""")
|
||||
|
||||
unop_horiz("unpack_double_2x32", 2, tuint32, 1, tuint64, """
|
||||
union {
|
||||
uint64_t u64;
|
||||
struct {
|
||||
uint32_t i1;
|
||||
uint32_t i2;
|
||||
};
|
||||
} di;
|
||||
|
||||
di.u64 = src0.x;
|
||||
dst.x = di.i1;
|
||||
dst.y = di.i2;
|
||||
""")
|
||||
|
||||
# Lowered floating point unpacking operations.
|
||||
|
||||
|
||||
|
|
@ -261,6 +298,29 @@ unop_horiz("unpack_half_2x16_split_x", 1, tfloat32, 1, tuint32,
|
|||
unop_horiz("unpack_half_2x16_split_y", 1, tfloat32, 1, tuint32,
|
||||
"unpack_half_1x16((uint16_t)(src0.x >> 16))")
|
||||
|
||||
unop_convert("unpack_double_2x32_split_x", tuint32, tuint64, """
|
||||
union {
|
||||
uint64_t u64;
|
||||
struct {
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
};
|
||||
} di;
|
||||
di.u64 = src0;
|
||||
dst = di.x;
|
||||
""")
|
||||
|
||||
unop_convert("unpack_double_2x32_split_y", tuint32, tuint64, """
|
||||
union {
|
||||
uint64_t u64;
|
||||
struct {
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
};
|
||||
} di;
|
||||
di.u64 = src0;
|
||||
dst = di.y;
|
||||
""")
|
||||
|
||||
# Bit operations, part of ARB_gpu_shader5.
|
||||
|
||||
|
|
@ -540,6 +600,19 @@ binop("fpow", tfloat, "", "bit_size == 64 ? powf(src0, src1) : pow(src0, src1)")
|
|||
binop_horiz("pack_half_2x16_split", 1, tuint32, 1, tfloat32, 1, tfloat32,
|
||||
"pack_half_1x16(src0.x) | (pack_half_1x16(src1.x) << 16)")
|
||||
|
||||
binop_convert("pack_double_2x32_split", tuint64, tuint32, "", """
|
||||
union {
|
||||
uint64_t u64;
|
||||
struct {
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
};
|
||||
} di;
|
||||
di.x = src0;
|
||||
di.y = src1;
|
||||
dst = di.u64;
|
||||
""")
|
||||
|
||||
# bfm implements the behavior of the first operation of the SM5 "bfi" assembly
|
||||
# and that of the "bfi1" i965 instruction. That is, it has undefined behavior
|
||||
# if either of its arguments are 32.
|
||||
|
|
|
|||
|
|
@ -138,7 +138,10 @@ optimizations = [
|
|||
(('~fmax', ('fmin', a, 1.0), 0.0), ('fsat', a), '!options->lower_fsat'),
|
||||
(('fsat', a), ('fmin', ('fmax', a, 0.0), 1.0), 'options->lower_fsat'),
|
||||
(('fsat', ('fsat', a)), ('fsat', a)),
|
||||
(('fmin', ('fmax', ('fmin', ('fmax', a, 0.0), 1.0), 0.0), 1.0), ('fmin', ('fmax', a, 0.0), 1.0)),
|
||||
(('fmin', ('fmax', ('fmin', ('fmax', a, b), c), b), c), ('fmin', ('fmax', a, b), c)),
|
||||
(('imin', ('imax', ('imin', ('imax', a, b), c), b), c), ('imin', ('imax', a, b), c)),
|
||||
(('umin', ('umax', ('umin', ('umax', a, b), c), b), c), ('umin', ('umax', a, b), c)),
|
||||
(('extract_u8', ('imin', ('imax', a, 0), 0xff), 0), ('imin', ('imax', a, 0), 0xff)),
|
||||
(('~ior', ('flt', a, b), ('flt', a, c)), ('flt', a, ('fmax', b, c))),
|
||||
(('~ior', ('flt', a, c), ('flt', b, c)), ('flt', ('fmin', a, b), c)),
|
||||
(('~ior', ('fge', a, b), ('fge', a, c)), ('fge', a, ('fmin', b, c))),
|
||||
|
|
@ -275,6 +278,14 @@ optimizations = [
|
|||
(('fmul', ('fneg', a), b), ('fneg', ('fmul', a, b))),
|
||||
(('imul', ('ineg', a), b), ('ineg', ('imul', a, b))),
|
||||
|
||||
# Reassociate constants in add/mul chains so they can be folded together.
|
||||
# For now, we only handle cases where the constants are separated by
|
||||
# a single non-constant. We could do better eventually.
|
||||
(('~fmul', '#a', ('fmul', b, '#c')), ('fmul', ('fmul', a, c), b)),
|
||||
(('imul', '#a', ('imul', b, '#c')), ('imul', ('imul', a, c), b)),
|
||||
(('~fadd', '#a', ('fadd', b, '#c')), ('fadd', ('fadd', a, c), b)),
|
||||
(('iadd', '#a', ('iadd', b, '#c')), ('iadd', ('iadd', a, c), b)),
|
||||
|
||||
# Misc. lowering
|
||||
(('fmod', a, b), ('fsub', a, ('fmul', b, ('ffloor', ('fdiv', a, b)))), 'options->lower_fmod'),
|
||||
(('frem', a, b), ('fsub', a, ('fmul', b, ('ftrunc', ('fdiv', a, b)))), 'options->lower_fmod'),
|
||||
|
|
@ -362,26 +373,30 @@ optimizations = [
|
|||
]
|
||||
|
||||
def fexp2i(exp):
|
||||
# We assume that exp is already in range.
|
||||
# We assume that exp is already in the range [-126, 127].
|
||||
return ('ishl', ('iadd', exp, 127), 23)
|
||||
|
||||
def ldexp32(f, exp):
|
||||
# First, we clamp exp to a reasonable range. The maximum range that we
|
||||
# need is the largest range for an exponent, ([-127, 128] if you include
|
||||
# inf and 0) plus the number of mantissa bits in either direction to
|
||||
# account for denormals. This means that we need at least a range of
|
||||
# [-150, 151]. For our implementation, however, what we really care
|
||||
# about is that neither exp/2 nor exp-exp/2 go out of the regular range
|
||||
# for floating-point exponents.
|
||||
# First, we clamp exp to a reasonable range. The maximum possible range
|
||||
# for a normal exponent is [-126, 127] and, throwing in denormals, you get
|
||||
# a maximum range of [-149, 127]. This means that we can potentially have
|
||||
# a swing of +-276. If you start with FLT_MAX, you actually have to do
|
||||
# ldexp(FLT_MAX, -278) to get it to flush all the way to zero. The GLSL
|
||||
# spec, on the other hand, only requires that we handle an exponent value
|
||||
# in the range [-126, 128]. This implementation is *mostly* correct; it
|
||||
# handles a range on exp of [-252, 254] which allows you to create any
|
||||
# value (including denorms if the hardware supports it) and to adjust the
|
||||
# exponent of any normal value to anything you want.
|
||||
exp = ('imin', ('imax', exp, -252), 254)
|
||||
|
||||
# Now we compute two powers of 2, one for exp/2 and one for exp-exp/2.
|
||||
# While the spec technically defines ldexp as f * 2.0^exp, simply
|
||||
# multiplying once doesn't work when denormals are involved because
|
||||
# 2.0^exp may not be representable even though ldexp(f, exp) is (see
|
||||
# comments above about range). Instead, we create two powers of two and
|
||||
# multiply by them each in turn. That way the effective range of our
|
||||
# exponent is doubled.
|
||||
# (We use ishr which isn't the same for -1, but the -1 case still works
|
||||
# since we use exp-exp/2 as the second exponent.) While the spec
|
||||
# technically defines ldexp as f * 2.0^exp, simply multiplying once doesn't
|
||||
# work with denormals and doesn't allow for the full swing in exponents
|
||||
# that you can get with normalized values. Instead, we create two powers
|
||||
# of two and multiply by them each in turn. That way the effective range
|
||||
# of our exponent is doubled.
|
||||
pow2_1 = fexp2i(('ishr', exp, 1))
|
||||
pow2_2 = fexp2i(('isub', exp, ('ishr', exp, 1)))
|
||||
return ('fmul', ('fmul', f, pow2_1), pow2_2)
|
||||
|
|
|
|||
|
|
@ -98,9 +98,9 @@ constant_fold_alu_instr(nir_alu_instr *instr, void *mem_ctx)
|
|||
|
||||
nir_load_const_instr *new_instr =
|
||||
nir_load_const_instr_create(mem_ctx,
|
||||
instr->dest.dest.ssa.num_components);
|
||||
instr->dest.dest.ssa.num_components,
|
||||
instr->dest.dest.ssa.bit_size);
|
||||
|
||||
new_instr->def.bit_size = instr->dest.dest.ssa.bit_size;
|
||||
new_instr->value = dest;
|
||||
|
||||
nir_instr_insert_before(&instr->instr, &new_instr->instr);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ init_instr(nir_instr *instr, struct exec_list *worklist)
|
|||
nir_tex_instr *tex_instr;
|
||||
|
||||
/* We use the pass_flags to store the live/dead information. In DCE, we
|
||||
* just treat it as a zero/non-zerl boolean for whether or not the
|
||||
* just treat it as a zero/non-zero boolean for whether or not the
|
||||
* instruction is live.
|
||||
*/
|
||||
instr->pass_flags = 0;
|
||||
|
|
|
|||
|
|
@ -195,7 +195,8 @@ nir_phi_builder_value_get_block_def(struct nir_phi_builder_value *val,
|
|||
*/
|
||||
nir_ssa_undef_instr *undef =
|
||||
nir_ssa_undef_instr_create(val->builder->shader,
|
||||
val->num_components);
|
||||
val->num_components,
|
||||
val->bit_size);
|
||||
nir_instr_insert(nir_before_cf_list(&val->builder->impl->body),
|
||||
&undef->instr);
|
||||
val->defs[block->index] = &undef->def;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@
|
|||
#include "compiler/shader_enums.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <inttypes.h> /* for PRIx64 macro */
|
||||
|
||||
static void
|
||||
print_tabs(unsigned num_tabs, FILE *fp)
|
||||
|
|
@ -68,7 +69,7 @@ static void
|
|||
print_register_decl(nir_register *reg, print_state *state)
|
||||
{
|
||||
FILE *fp = state->fp;
|
||||
fprintf(fp, "decl_reg %s ", sizes[reg->num_components]);
|
||||
fprintf(fp, "decl_reg %s %u ", sizes[reg->num_components], reg->bit_size);
|
||||
if (reg->is_packed)
|
||||
fprintf(fp, "(packed) ");
|
||||
print_register(reg, state);
|
||||
|
|
@ -83,7 +84,8 @@ print_ssa_def(nir_ssa_def *def, print_state *state)
|
|||
FILE *fp = state->fp;
|
||||
if (def->name != NULL)
|
||||
fprintf(fp, "/* %s */ ", def->name);
|
||||
fprintf(fp, "%s ssa_%u", sizes[def->num_components], def->index);
|
||||
fprintf(fp, "%s %u ssa_%u", sizes[def->num_components], def->bit_size,
|
||||
def->index);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -279,6 +281,13 @@ print_constant(nir_constant *c, const struct glsl_type *type, print_state *state
|
|||
}
|
||||
break;
|
||||
|
||||
case GLSL_TYPE_DOUBLE:
|
||||
for (i = 0; i < total_elems; i++) {
|
||||
if (i > 0) fprintf(fp, ", ");
|
||||
fprintf(fp, "%f", c->value.d[i]);
|
||||
}
|
||||
break;
|
||||
|
||||
case GLSL_TYPE_STRUCT:
|
||||
for (i = 0; i < c->num_elements; i++) {
|
||||
if (i > 0) fprintf(fp, ", ");
|
||||
|
|
@ -716,7 +725,11 @@ print_load_const_instr(nir_load_const_instr *instr, print_state *state)
|
|||
* and then print the float in a comment for readability.
|
||||
*/
|
||||
|
||||
fprintf(fp, "0x%08x /* %f */", instr->value.u32[i], instr->value.f32[i]);
|
||||
if (instr->def.bit_size == 64)
|
||||
fprintf(fp, "0x%16" PRIx64 " /* %f */", instr->value.u64[i],
|
||||
instr->value.f64[i]);
|
||||
else
|
||||
fprintf(fp, "0x%08x /* %f */", instr->value.u32[i], instr->value.f32[i]);
|
||||
}
|
||||
|
||||
fprintf(fp, ")");
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ remove_dead_vars(struct exec_list *var_list, struct set *live)
|
|||
}
|
||||
|
||||
bool
|
||||
nir_remove_dead_variables(nir_shader *shader, nir_variable_mode mode)
|
||||
nir_remove_dead_variables(nir_shader *shader, nir_variable_mode modes)
|
||||
{
|
||||
bool progress = false;
|
||||
struct set *live =
|
||||
|
|
@ -128,22 +128,22 @@ nir_remove_dead_variables(nir_shader *shader, nir_variable_mode mode)
|
|||
|
||||
add_var_use_shader(shader, live);
|
||||
|
||||
if (mode == nir_var_uniform || mode == nir_var_all)
|
||||
if (modes & nir_var_uniform)
|
||||
progress = remove_dead_vars(&shader->uniforms, live) || progress;
|
||||
|
||||
if (mode == nir_var_shader_in || mode == nir_var_all)
|
||||
if (modes & nir_var_shader_in)
|
||||
progress = remove_dead_vars(&shader->inputs, live) || progress;
|
||||
|
||||
if (mode == nir_var_shader_out || mode == nir_var_all)
|
||||
if (modes & nir_var_shader_out)
|
||||
progress = remove_dead_vars(&shader->outputs, live) || progress;
|
||||
|
||||
if (mode == nir_var_global || mode == nir_var_all)
|
||||
if (modes & nir_var_global)
|
||||
progress = remove_dead_vars(&shader->globals, live) || progress;
|
||||
|
||||
if (mode == nir_var_system_value || mode == nir_var_all)
|
||||
if (modes & nir_var_system_value)
|
||||
progress = remove_dead_vars(&shader->system_values, live) || progress;
|
||||
|
||||
if (mode == nir_var_local || mode == nir_var_all) {
|
||||
if (modes & nir_var_local) {
|
||||
nir_foreach_function(shader, function) {
|
||||
if (function->impl) {
|
||||
if (remove_dead_vars(&function->impl->locals, live)) {
|
||||
|
|
|
|||
|
|
@ -477,7 +477,8 @@ construct_value(const nir_search_value *value,
|
|||
|
||||
case nir_search_value_constant: {
|
||||
const nir_search_constant *c = nir_search_value_as_constant(value);
|
||||
nir_load_const_instr *load = nir_load_const_instr_create(mem_ctx, 1);
|
||||
nir_load_const_instr *load =
|
||||
nir_load_const_instr_create(mem_ctx, 1, bitsize->dest_size);
|
||||
|
||||
switch (c->type) {
|
||||
case nir_type_float:
|
||||
|
|
@ -528,8 +529,6 @@ construct_value(const nir_search_value *value,
|
|||
unreachable("Invalid alu source type");
|
||||
}
|
||||
|
||||
load->def.bit_size = bitsize->dest_size;
|
||||
|
||||
nir_instr_insert_before(instr, &load->instr);
|
||||
|
||||
nir_alu_src val;
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ split_var_copy_instr(nir_intrinsic_instr *old_copy,
|
|||
case GLSL_TYPE_UINT:
|
||||
case GLSL_TYPE_INT:
|
||||
case GLSL_TYPE_FLOAT:
|
||||
case GLSL_TYPE_DOUBLE:
|
||||
case GLSL_TYPE_BOOL:
|
||||
if (glsl_type_is_matrix(src_tail->type)) {
|
||||
nir_deref_array *deref = nir_deref_array_create(state->dead_ctx);
|
||||
|
|
@ -231,6 +232,7 @@ split_var_copies_block(nir_block *block, void *void_state)
|
|||
ralloc_steal(state->dead_ctx, instr);
|
||||
break;
|
||||
case GLSL_TYPE_FLOAT:
|
||||
case GLSL_TYPE_DOUBLE:
|
||||
case GLSL_TYPE_INT:
|
||||
case GLSL_TYPE_UINT:
|
||||
case GLSL_TYPE_BOOL:
|
||||
|
|
|
|||
|
|
@ -160,7 +160,8 @@ static nir_ssa_def *get_ssa_src(nir_register *reg, rewrite_state *state)
|
|||
* to preserve the information that this source is undefined
|
||||
*/
|
||||
nir_ssa_undef_instr *instr =
|
||||
nir_ssa_undef_instr_create(state->mem_ctx, reg->num_components);
|
||||
nir_ssa_undef_instr_create(state->mem_ctx, reg->num_components,
|
||||
reg->bit_size);
|
||||
|
||||
/*
|
||||
* We could just insert the undefined instruction before the instruction
|
||||
|
|
|
|||
|
|
@ -903,6 +903,9 @@ validate_var_decl(nir_variable *var, bool is_global, validate_state *state)
|
|||
{
|
||||
assert(is_global == nir_variable_is_global(var));
|
||||
|
||||
/* Must have exactly one mode set */
|
||||
assert(util_bitcount(var->data.mode) == 1);
|
||||
|
||||
/*
|
||||
* TODO validate some things ir_validate.cpp does (requires more GLSL type
|
||||
* support)
|
||||
|
|
|
|||
|
|
@ -86,7 +86,7 @@ vtn_const_ssa_value(struct vtn_builder *b, nir_constant *constant,
|
|||
if (glsl_type_is_vector_or_scalar(type)) {
|
||||
unsigned num_components = glsl_get_vector_elements(val->type);
|
||||
nir_load_const_instr *load =
|
||||
nir_load_const_instr_create(b->shader, num_components);
|
||||
nir_load_const_instr_create(b->shader, num_components, 32);
|
||||
|
||||
for (unsigned i = 0; i < num_components; i++)
|
||||
load->value.u32[i] = constant->value.u[i];
|
||||
|
|
@ -103,7 +103,7 @@ vtn_const_ssa_value(struct vtn_builder *b, nir_constant *constant,
|
|||
struct vtn_ssa_value *col_val = rzalloc(b, struct vtn_ssa_value);
|
||||
col_val->type = glsl_get_column_type(val->type);
|
||||
nir_load_const_instr *load =
|
||||
nir_load_const_instr_create(b->shader, rows);
|
||||
nir_load_const_instr_create(b->shader, rows, 32);
|
||||
|
||||
for (unsigned j = 0; j < rows; j++)
|
||||
load->value.u32[j] = constant->value.u[rows * i + j];
|
||||
|
|
|
|||
|
|
@ -126,9 +126,9 @@ glsl_get_aoa_size(const struct glsl_type *type)
|
|||
|
||||
unsigned
|
||||
glsl_count_attribute_slots(const struct glsl_type *type,
|
||||
bool vertex_input_slots)
|
||||
bool is_vertex_input)
|
||||
{
|
||||
return type->count_attribute_slots(vertex_input_slots);
|
||||
return type->count_attribute_slots(is_vertex_input);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ unsigned glsl_get_length(const struct glsl_type *type);
|
|||
unsigned glsl_get_aoa_size(const struct glsl_type *type);
|
||||
|
||||
unsigned glsl_count_attribute_slots(const struct glsl_type *type,
|
||||
bool vertex_input_slots);
|
||||
bool is_vertex_input);
|
||||
|
||||
const char *glsl_get_struct_elem_name(const struct glsl_type *type,
|
||||
unsigned index);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
include Makefile.sources
|
||||
include $(top_srcdir)/src/gallium/Automake.inc
|
||||
|
||||
noinst_LTLIBRARIES = libgallium_nir.la
|
||||
noinst_LTLIBRARIES = libgallium.la
|
||||
|
||||
AM_CFLAGS = \
|
||||
-I$(top_srcdir)/src/loader \
|
||||
-I$(top_builddir)/src/compiler/nir \
|
||||
-I$(top_srcdir)/src/gallium/auxiliary/util \
|
||||
$(GALLIUM_CFLAGS) \
|
||||
$(VISIBILITY_CFLAGS) \
|
||||
|
|
@ -14,24 +15,11 @@ AM_CXXFLAGS = \
|
|||
$(VISIBILITY_CXXFLAGS) \
|
||||
$(MSVC2013_COMPAT_CXXFLAGS)
|
||||
|
||||
libgallium_nir_la_SOURCES = \
|
||||
$(NIR_SOURCES)
|
||||
|
||||
libgallium_nir_la_CFLAGS = \
|
||||
-I$(top_builddir)/src/compiler/nir \
|
||||
$(GALLIUM_CFLAGS) \
|
||||
$(VISIBILITY_CFLAGS) \
|
||||
$(MSVC2013_COMPAT_CFLAGS)
|
||||
|
||||
noinst_LTLIBRARIES += libgallium.la
|
||||
|
||||
libgallium_la_SOURCES = \
|
||||
$(C_SOURCES) \
|
||||
$(NIR_SOURCES) \
|
||||
$(GENERATED_SOURCES)
|
||||
|
||||
libgallium_la_LIBADD = \
|
||||
libgallium_nir.la
|
||||
|
||||
if HAVE_MESA_LLVM
|
||||
|
||||
AM_CFLAGS += \
|
||||
|
|
|
|||
|
|
@ -1539,6 +1539,8 @@ cso_save_state(struct cso_context *cso, unsigned state_mask)
|
|||
cso_save_vertex_shader(cso);
|
||||
if (state_mask & CSO_BIT_VIEWPORT)
|
||||
cso_save_viewport(cso);
|
||||
if (state_mask & CSO_BIT_PAUSE_QUERIES)
|
||||
cso->pipe->set_active_query_state(cso->pipe, false);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1590,6 +1592,8 @@ cso_restore_state(struct cso_context *cso)
|
|||
cso_restore_vertex_shader(cso);
|
||||
if (state_mask & CSO_BIT_VIEWPORT)
|
||||
cso_restore_viewport(cso);
|
||||
if (state_mask & CSO_BIT_PAUSE_QUERIES)
|
||||
cso->pipe->set_active_query_state(cso->pipe, true);
|
||||
|
||||
cso->saved_state = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ void cso_set_render_condition(struct cso_context *cso,
|
|||
#define CSO_BIT_VERTEX_ELEMENTS 0x10000
|
||||
#define CSO_BIT_VERTEX_SHADER 0x20000
|
||||
#define CSO_BIT_VIEWPORT 0x40000
|
||||
#define CSO_BIT_PAUSE_QUERIES 0x80000
|
||||
|
||||
#define CSO_BITS_ALL_SHADERS (CSO_BIT_VERTEX_SHADER | \
|
||||
CSO_BIT_FRAGMENT_SHADER | \
|
||||
|
|
|
|||
|
|
@ -749,7 +749,23 @@ draw_image(struct draw_context *draw,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Provide TGSI buffer objects for vertex/geometry shaders that use
|
||||
* load/store/atomic ops. This state only needs to be set once per context.
|
||||
* This might only be used by software drivers for the time being.
|
||||
*/
|
||||
void
|
||||
draw_buffer(struct draw_context *draw,
|
||||
uint shader,
|
||||
struct tgsi_buffer *buffer)
|
||||
{
|
||||
if (shader == PIPE_SHADER_VERTEX) {
|
||||
draw->vs.tgsi.buffer = buffer;
|
||||
} else {
|
||||
debug_assert(shader == PIPE_SHADER_GEOMETRY);
|
||||
draw->gs.tgsi.buffer = buffer;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_set_render( struct draw_context *draw,
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ struct draw_geometry_shader;
|
|||
struct draw_fragment_shader;
|
||||
struct tgsi_sampler;
|
||||
struct tgsi_image;
|
||||
struct tgsi_buffer;
|
||||
|
||||
/*
|
||||
* structure to contain driver internal information
|
||||
|
|
@ -160,6 +161,11 @@ draw_image(struct draw_context *draw,
|
|||
uint shader_type,
|
||||
struct tgsi_image *image);
|
||||
|
||||
void
|
||||
draw_buffer(struct draw_context *draw,
|
||||
uint shader_type,
|
||||
struct tgsi_buffer *buffer);
|
||||
|
||||
void
|
||||
draw_set_sampler_views(struct draw_context *draw,
|
||||
unsigned shader_stage,
|
||||
|
|
|
|||
|
|
@ -681,7 +681,9 @@ void draw_geometry_shader_prepare(struct draw_geometry_shader *shader,
|
|||
if (!use_llvm && shader && shader->machine->Tokens != shader->state.tokens) {
|
||||
tgsi_exec_machine_bind_shader(shader->machine,
|
||||
shader->state.tokens,
|
||||
draw->gs.tgsi.sampler, draw->gs.tgsi.image);
|
||||
draw->gs.tgsi.sampler,
|
||||
draw->gs.tgsi.image,
|
||||
draw->gs.tgsi.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ struct vbuf_render;
|
|||
struct tgsi_exec_machine;
|
||||
struct tgsi_sampler;
|
||||
struct tgsi_image;
|
||||
struct tgsi_buffer;
|
||||
struct draw_pt_front_end;
|
||||
struct draw_assembler;
|
||||
struct draw_llvm;
|
||||
|
|
@ -269,6 +270,7 @@ struct draw_context
|
|||
|
||||
struct tgsi_sampler *sampler;
|
||||
struct tgsi_image *image;
|
||||
struct tgsi_buffer *buffer;
|
||||
} tgsi;
|
||||
|
||||
struct translate *fetch;
|
||||
|
|
@ -289,6 +291,7 @@ struct draw_context
|
|||
|
||||
struct tgsi_sampler *sampler;
|
||||
struct tgsi_image *image;
|
||||
struct tgsi_buffer *buffer;
|
||||
} tgsi;
|
||||
|
||||
} gs;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,9 @@ vs_exec_prepare( struct draw_vertex_shader *shader,
|
|||
if (evs->machine->Tokens != shader->state.tokens) {
|
||||
tgsi_exec_machine_bind_shader(evs->machine,
|
||||
shader->state.tokens,
|
||||
draw->vs.tgsi.sampler, draw->vs.tgsi.image);
|
||||
draw->vs.tgsi.sampler,
|
||||
draw->vs.tgsi.image,
|
||||
draw->vs.tgsi.buffer);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,6 +161,7 @@ vs_exec_run_linear( struct draw_vertex_shader *shader,
|
|||
input = (const float (*)[4])((const char *)input + input_stride);
|
||||
}
|
||||
|
||||
machine->NonHelperMask = (1 << max_vertices) - 1;
|
||||
/* run interpreter */
|
||||
tgsi_exec_machine_run( machine );
|
||||
|
||||
|
|
|
|||
|
|
@ -1492,9 +1492,20 @@ lp_build_abs(struct lp_build_context *bld,
|
|||
return a;
|
||||
|
||||
if(type.floating) {
|
||||
char intrinsic[32];
|
||||
lp_format_intrinsic(intrinsic, sizeof intrinsic, "llvm.fabs", vec_type);
|
||||
return lp_build_intrinsic_unary(builder, intrinsic, vec_type, a);
|
||||
if (0x0306 <= HAVE_LLVM && HAVE_LLVM < 0x0309) {
|
||||
/* Workaround llvm.org/PR27332 */
|
||||
LLVMTypeRef int_vec_type = lp_build_int_vec_type(bld->gallivm, type);
|
||||
unsigned long long absMask = ~(1ULL << (type.width - 1));
|
||||
LLVMValueRef mask = lp_build_const_int_vec(bld->gallivm, type, ((unsigned long long) absMask));
|
||||
a = LLVMBuildBitCast(builder, a, int_vec_type, "");
|
||||
a = LLVMBuildAnd(builder, a, mask, "");
|
||||
a = LLVMBuildBitCast(builder, a, vec_type, "");
|
||||
return a;
|
||||
} else {
|
||||
char intrinsic[32];
|
||||
lp_format_intrinsic(intrinsic, sizeof intrinsic, "llvm.fabs", vec_type);
|
||||
return lp_build_intrinsic_unary(builder, intrinsic, vec_type, a);
|
||||
}
|
||||
}
|
||||
|
||||
if(type.width*type.length == 128 && util_cpu_caps.has_ssse3) {
|
||||
|
|
@ -1663,99 +1674,6 @@ enum lp_build_round_mode
|
|||
LP_BUILD_ROUND_TRUNCATE = 3
|
||||
};
|
||||
|
||||
/**
|
||||
* Helper for SSE4.1's ROUNDxx instructions.
|
||||
*
|
||||
* NOTE: In the SSE4.1's nearest mode, if two values are equally close, the
|
||||
* result is the even value. That is, rounding 2.5 will be 2.0, and not 3.0.
|
||||
*/
|
||||
static inline LLVMValueRef
|
||||
lp_build_nearest_sse41(struct lp_build_context *bld,
|
||||
LLVMValueRef a)
|
||||
{
|
||||
LLVMBuilderRef builder = bld->gallivm->builder;
|
||||
const struct lp_type type = bld->type;
|
||||
LLVMTypeRef i32t = LLVMInt32TypeInContext(bld->gallivm->context);
|
||||
LLVMValueRef mode = LLVMConstNull(i32t);
|
||||
const char *intrinsic;
|
||||
LLVMValueRef res;
|
||||
|
||||
assert(type.floating);
|
||||
|
||||
assert(lp_check_value(type, a));
|
||||
assert(util_cpu_caps.has_sse4_1);
|
||||
|
||||
if (type.length == 1) {
|
||||
LLVMTypeRef vec_type;
|
||||
LLVMValueRef undef;
|
||||
LLVMValueRef args[3];
|
||||
LLVMValueRef index0 = LLVMConstInt(i32t, 0, 0);
|
||||
|
||||
switch(type.width) {
|
||||
case 32:
|
||||
intrinsic = "llvm.x86.sse41.round.ss";
|
||||
break;
|
||||
case 64:
|
||||
intrinsic = "llvm.x86.sse41.round.sd";
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
return bld->undef;
|
||||
}
|
||||
|
||||
vec_type = LLVMVectorType(bld->elem_type, 4);
|
||||
|
||||
undef = LLVMGetUndef(vec_type);
|
||||
|
||||
args[0] = undef;
|
||||
args[1] = LLVMBuildInsertElement(builder, undef, a, index0, "");
|
||||
args[2] = mode;
|
||||
|
||||
res = lp_build_intrinsic(builder, intrinsic,
|
||||
vec_type, args, Elements(args), 0);
|
||||
|
||||
res = LLVMBuildExtractElement(builder, res, index0, "");
|
||||
}
|
||||
else {
|
||||
if (type.width * type.length == 128) {
|
||||
switch(type.width) {
|
||||
case 32:
|
||||
intrinsic = "llvm.x86.sse41.round.ps";
|
||||
break;
|
||||
case 64:
|
||||
intrinsic = "llvm.x86.sse41.round.pd";
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
return bld->undef;
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert(type.width * type.length == 256);
|
||||
assert(util_cpu_caps.has_avx);
|
||||
|
||||
switch(type.width) {
|
||||
case 32:
|
||||
intrinsic = "llvm.x86.avx.round.ps.256";
|
||||
break;
|
||||
case 64:
|
||||
intrinsic = "llvm.x86.avx.round.pd.256";
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
return bld->undef;
|
||||
}
|
||||
}
|
||||
|
||||
res = lp_build_intrinsic_binary(builder, intrinsic,
|
||||
bld->vec_type, a,
|
||||
mode);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static inline LLVMValueRef
|
||||
lp_build_iround_nearest_sse2(struct lp_build_context *bld,
|
||||
LLVMValueRef a)
|
||||
|
|
@ -1863,11 +1781,7 @@ lp_build_round_arch(struct lp_build_context *bld,
|
|||
|
||||
switch (mode) {
|
||||
case LP_BUILD_ROUND_NEAREST:
|
||||
if (HAVE_LLVM >= 0x0304) {
|
||||
intrinsic_root = "llvm.round";
|
||||
} else {
|
||||
return lp_build_nearest_sse41(bld, a);
|
||||
}
|
||||
intrinsic_root = "llvm.nearbyint";
|
||||
break;
|
||||
case LP_BUILD_ROUND_FLOOR:
|
||||
intrinsic_root = "llvm.floor";
|
||||
|
|
|
|||
|
|
@ -477,6 +477,7 @@ hud_draw(struct hud_context *hud, struct pipe_resource *tex)
|
|||
CSO_BIT_VERTEX_SHADER |
|
||||
CSO_BIT_VERTEX_ELEMENTS |
|
||||
CSO_BIT_AUX_VERTEX_BUFFER_SLOT |
|
||||
CSO_BIT_PAUSE_QUERIES |
|
||||
CSO_BIT_RENDER_CONDITION));
|
||||
cso_save_constant_buffer_slot0(cso, PIPE_SHADER_VERTEX);
|
||||
|
||||
|
|
|
|||
|
|
@ -454,7 +454,7 @@ ttn_emit_immediate(struct ttn_compile *c)
|
|||
nir_load_const_instr *load_const;
|
||||
int i;
|
||||
|
||||
load_const = nir_load_const_instr_create(b->shader, 4);
|
||||
load_const = nir_load_const_instr_create(b->shader, 4, 32);
|
||||
c->imm_defs[c->next_imm] = &load_const->def;
|
||||
c->next_imm++;
|
||||
|
||||
|
|
|
|||
|
|
@ -87,9 +87,9 @@ struct pb_desc
|
|||
|
||||
|
||||
/**
|
||||
* Size. Regular (32bit) unsigned for now.
|
||||
* 64-bit type for GPU buffer sizes and offsets.
|
||||
*/
|
||||
typedef unsigned pb_size;
|
||||
typedef uint64_t pb_size;
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -98,8 +98,8 @@ typedef unsigned pb_size;
|
|||
struct pb_buffer
|
||||
{
|
||||
struct pipe_reference reference;
|
||||
unsigned size;
|
||||
unsigned alignment;
|
||||
pb_size size;
|
||||
unsigned usage;
|
||||
|
||||
/**
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue