summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKenneth Graunke <kenneth@whitecape.org>2018-08-23 20:58:32 -0700
committerKenneth Graunke <kenneth@whitecape.org>2018-08-24 00:36:01 -0700
commit9d670fd86cc13df0ddff5c6fcb0835926e9a8088 (patch)
treeb08ebee381703f36a5c1d22ee9becde4116a22bf
parent8e1be9a34ac8ce6f115eaf2ab0d99b6a0ce37630 (diff)
downloadmesa-9d670fd86cc13df0ddff5c6fcb0835926e9a8088.tar.gz
mesa-9d670fd86cc13df0ddff5c6fcb0835926e9a8088.tar.bz2
mesa-9d670fd86cc13df0ddff5c6fcb0835926e9a8088.zip
Revert recent changes about not including compute in combined limits.
As far as I can tell, no one reviewed these changes, they made i965 assert fail on driver load, and I am not certain they are correct. (Hopefully reverting these does not break radeonsi too badly...) The uniform related changes seem fine and reasonable, but the texture image units change is possibly incorrect. According to the OES_tessellation_shader spec issue 5: (5) How are aggregate shader limits computed? RESOLVED: Following the GL 4.4 model, but we restrict uniform buffer bindings to 12/stage instead of 14, this results in MAX_UNIFORM_BUFFER_BINDINGS = 72 This is 12 bindings/stage * 6 shader stages, allowing a static partitioning of the bindings even though at most 5 stages can appear in a program object). MAX_COMBINED_UNIFORM_BLOCKS = 60 This is 12 blocks/stage * 5 stages, since compute shaders can't be mixed with other stages. MAX_COMBINED_TEXTURE_IMAGE_UNITS = 96 This is 16 textures/stage * 6 stages. which definitely is including compute shaders in that last limit. Not including compute shaders breaks the following test: dEQP-GLES31.functional.state_query.integer.max_combined_texture_image_units_getinteger There was enough breakage that I figured we should just send this back to the drawing board. Revert "i965: don't include compute resources in "Combined" limits" Revert "st/mesa: don't include compute resources in "Combined" limits" Revert "mesa: don't include compute resources in MAX_COMBINED_* limits" This reverts commit b03dcb1e5f507c5950d0de053a6f76e6306ee71f. This reverts commit cff290df4c09547cd2cb3b129ec59bdebdadba90. This reverts commit 45f87a48f94148b484961f18a4f1ccf86f066b1c.
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.c22
-rw-r--r--src/mesa/main/config.h22
-rw-r--r--src/mesa/state_tracker/st_extensions.c9
3 files changed, 26 insertions, 27 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c
index 59871ed84e2..6ba64e4e06d 100644
--- a/src/mesa/drivers/dri/i965/brw_context.c
+++ b/src/mesa/drivers/dri/i965/brw_context.c
@@ -421,10 +421,10 @@ brw_initialize_context_constants(struct brw_context *brw)
ctx->Const.MaxComputeWorkGroupSize[0] >= 128),
};
- unsigned num_gfx_stages = 0;
- for (int i = 0; i < MESA_SHADER_COMPUTE; i++) {
+ unsigned num_stages = 0;
+ for (int i = 0; i < MESA_SHADER_STAGES; i++) {
if (stage_exists[i])
- num_gfx_stages++;
+ num_stages++;
}
unsigned max_samplers =
@@ -505,14 +505,14 @@ brw_initialize_context_constants(struct brw_context *brw)
MIN2(ctx->Const.MaxTextureCoordUnits,
ctx->Const.Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits);
- ctx->Const.MaxUniformBufferBindings = num_gfx_stages * BRW_MAX_UBO;
- ctx->Const.MaxCombinedUniformBlocks = num_gfx_stages * BRW_MAX_UBO;
- ctx->Const.MaxCombinedAtomicBuffers = num_gfx_stages * BRW_MAX_ABO;
- ctx->Const.MaxCombinedShaderStorageBlocks = num_gfx_stages * BRW_MAX_SSBO;
- ctx->Const.MaxCombinedTextureImageUnits = num_gfx_stages * max_samplers;
- ctx->Const.MaxCombinedImageUniforms = num_gfx_stages * BRW_MAX_IMAGES;
- ctx->Const.MaxShaderStorageBufferBindings =
- (num_gfx_stages + stage_exists[MESA_SHADER_COMPUTE]) * BRW_MAX_SSBO;
+ ctx->Const.MaxUniformBufferBindings = num_stages * BRW_MAX_UBO;
+ ctx->Const.MaxCombinedUniformBlocks = num_stages * BRW_MAX_UBO;
+ ctx->Const.MaxCombinedAtomicBuffers = num_stages * BRW_MAX_ABO;
+ ctx->Const.MaxCombinedShaderStorageBlocks = num_stages * BRW_MAX_SSBO;
+ ctx->Const.MaxShaderStorageBufferBindings = num_stages * BRW_MAX_SSBO;
+ ctx->Const.MaxCombinedTextureImageUnits = num_stages * max_samplers;
+ ctx->Const.MaxCombinedImageUniforms = num_stages * BRW_MAX_IMAGES;
+
/* Hardware only supports a limited number of transform feedback buffers.
* So we need to override the Mesa default (which is based only on software
diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h
index 19bc6b2457e..6f514650009 100644
--- a/src/mesa/main/config.h
+++ b/src/mesa/main/config.h
@@ -173,19 +173,17 @@
#define MAX_UNIFORMS 4096
#define MAX_UNIFORM_BUFFERS 15 /* + 1 default uniform buffer */
#define MAX_SHADER_STORAGE_BUFFERS 16
-/* 5 is for vertex, hull, domain, geometry, and fragment shader. Don't
- * include compute.
- */
-#define MAX_COMBINED_UNIFORM_BUFFERS (MAX_UNIFORM_BUFFERS * 5)
-#define MAX_COMBINED_SHADER_STORAGE_BUFFERS (MAX_SHADER_STORAGE_BUFFERS * 5)
+/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
+#define MAX_COMBINED_UNIFORM_BUFFERS (MAX_UNIFORM_BUFFERS * 6)
+#define MAX_COMBINED_SHADER_STORAGE_BUFFERS (MAX_SHADER_STORAGE_BUFFERS * 6)
#define MAX_ATOMIC_COUNTERS 4096
-/* 5 is for vertex, hull, domain, geometry, and fragment shader. */
-#define MAX_COMBINED_ATOMIC_BUFFERS (MAX_UNIFORM_BUFFERS * 5)
+/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
+#define MAX_COMBINED_ATOMIC_BUFFERS (MAX_UNIFORM_BUFFERS * 6)
/* Size of an atomic counter in bytes according to ARB_shader_atomic_counters */
#define ATOMIC_COUNTER_SIZE 4
#define MAX_IMAGE_UNIFORMS 32
-/* 5 is for vertex, hull, domain, geometry, and fragment shader. */
-#define MAX_IMAGE_UNITS (MAX_IMAGE_UNIFORMS * 5)
+/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
+#define MAX_IMAGE_UNITS (MAX_IMAGE_UNIFORMS * 6)
/*@}*/
/**
@@ -224,10 +222,8 @@
/** For GL_ARB_vertex_shader */
/*@{*/
#define MAX_VERTEX_GENERIC_ATTRIBS 16
-/* 5 is the number of shader stages that can be used at the same time.
- * compute can't be used at the same time as other shaders.
- */
-#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS * 5)
+/* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
+#define MAX_COMBINED_TEXTURE_IMAGE_UNITS (MAX_TEXTURE_IMAGE_UNITS * 6)
/*@}*/
diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c
index 2a1b2931d5a..a63c58c8acb 100644
--- a/src/mesa/state_tracker/st_extensions.c
+++ b/src/mesa/state_tracker/st_extensions.c
@@ -337,7 +337,8 @@ void st_init_limits(struct pipe_screen *screen,
c->Program[MESA_SHADER_TESS_CTRL].MaxTextureImageUnits +
c->Program[MESA_SHADER_TESS_EVAL].MaxTextureImageUnits +
c->Program[MESA_SHADER_GEOMETRY].MaxTextureImageUnits +
- c->Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits,
+ c->Program[MESA_SHADER_FRAGMENT].MaxTextureImageUnits +
+ c->Program[MESA_SHADER_COMPUTE].MaxTextureImageUnits,
MAX_COMBINED_TEXTURE_IMAGE_UNITS);
/* This depends on program constants. */
@@ -412,7 +413,8 @@ void st_init_limits(struct pipe_screen *screen,
c->Program[MESA_SHADER_TESS_CTRL].MaxUniformBlocks +
c->Program[MESA_SHADER_TESS_EVAL].MaxUniformBlocks +
c->Program[MESA_SHADER_GEOMETRY].MaxUniformBlocks +
- c->Program[MESA_SHADER_FRAGMENT].MaxUniformBlocks,
+ c->Program[MESA_SHADER_FRAGMENT].MaxUniformBlocks +
+ c->Program[MESA_SHADER_COMPUTE].MaxUniformBlocks;
assert(c->MaxCombinedUniformBlocks <= MAX_COMBINED_UNIFORM_BUFFERS);
}
@@ -478,7 +480,8 @@ void st_init_limits(struct pipe_screen *screen,
c->Program[MESA_SHADER_TESS_CTRL].MaxImageUniforms +
c->Program[MESA_SHADER_TESS_EVAL].MaxImageUniforms +
c->Program[MESA_SHADER_GEOMETRY].MaxImageUniforms +
- c->Program[MESA_SHADER_FRAGMENT].MaxImageUniforms;
+ c->Program[MESA_SHADER_FRAGMENT].MaxImageUniforms +
+ c->Program[MESA_SHADER_COMPUTE].MaxImageUniforms;
c->MaxCombinedShaderOutputResources += c->MaxCombinedImageUniforms;
c->MaxImageUnits = MAX_IMAGE_UNITS;
if (c->MaxCombinedImageUniforms) {