Commit 8c4c9e37 by Chris Forbes

Clean up interface component counting and reduce to spec minimum

This will halve the size of the input and output arrays used to communicate with the shader. This is likely to have been already cleaned up by llvm, but better to not make the mess to start with. Bug: b/125909515 Change-Id: I960647f808b722fe8ad38ff716df1461e1eae4ef Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/33788Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarAlexis Hétu <sugoi@google.com>
parent 8900e7c5
......@@ -49,14 +49,6 @@ namespace sw
{
OUTLINE_RESOLUTION = 8192, // Maximum vertical resolution of the render target
MIPMAP_LEVELS = 14,
FRAGMENT_UNIFORM_VECTORS = 264,
VERTEX_UNIFORM_VECTORS = 259,
MAX_VERTEX_INPUTS = 32,
MAX_VERTEX_OUTPUTS = 34,
MAX_FRAGMENT_INPUTS = 32,
MAX_FRAGMENT_UNIFORM_BLOCKS = 12,
MAX_VERTEX_UNIFORM_BLOCKS = 12,
MAX_UNIFORM_BUFFER_BINDINGS = MAX_FRAGMENT_UNIFORM_BLOCKS + MAX_VERTEX_UNIFORM_BLOCKS, // Limited to 127 by SourceParameter.bufferIndex in Shader.hpp
MAX_UNIFORM_BLOCK_SIZE = 16384,
MAX_CLIP_PLANES = 6,
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 64,
......@@ -65,8 +57,7 @@ namespace sw
MAX_PROGRAM_TEXEL_OFFSET = 7,
MAX_TEXTURE_LOD = MIPMAP_LEVELS - 2, // Trilinear accesses lod+1
RENDERTARGETS = 8,
NUM_TEMPORARY_REGISTERS = 4096,
MAX_INTERFACE_COMPONENTS = 32 * 4, // Must be multiple of 4 for 16-byte alignment.
MAX_INTERFACE_COMPONENTS = 16 * 4, // Must be multiple of 4 for 16-byte alignment.
};
}
......
......@@ -86,7 +86,7 @@ namespace sw
void Context::init()
{
// Set vertex streams to null stream
for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
for(int i = 0; i < MAX_INTERFACE_COMPONENTS/4; i++)
{
input[i].defaults();
}
......
......@@ -81,7 +81,7 @@ namespace sw
vk::DescriptorSet::Bindings descriptorSets = {};
vk::DescriptorSet::DynamicOffsets descriptorDynamicOffsets = {};
Stream input[MAX_VERTEX_INPUTS];
Stream input[MAX_INTERFACE_COMPONENTS / 4];
void *indexBuffer;
vk::ImageView *renderTarget[RENDERTARGETS];
......
......@@ -363,7 +363,7 @@ namespace sw
ASSERT(!draw->events);
draw->events = events;
for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
for(int i = 0; i < MAX_INTERFACE_COMPONENTS/4; i++)
{
data->input[i] = context->input[i].buffer;
data->stride[i] = context->input[i].vertexStride;
......
......@@ -52,8 +52,8 @@ namespace sw
vk::DescriptorSet::Bindings descriptorSets = {};
vk::DescriptorSet::DynamicOffsets descriptorDynamicOffsets = {};
const void *input[MAX_VERTEX_INPUTS];
unsigned int stride[MAX_VERTEX_INPUTS];
const void *input[MAX_INTERFACE_COMPONENTS / 4];
unsigned int stride[MAX_INTERFACE_COMPONENTS / 4];
const void *indices;
int instanceID;
......
......@@ -79,7 +79,7 @@ namespace sw
state.shaderID = context->vertexShader->getSerialID();
for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
for(int i = 0; i < MAX_INTERFACE_COMPONENTS / 4; i++)
{
state.input[i].type = context->input[i].type;
state.input[i].count = context->input[i].count;
......
......@@ -70,7 +70,7 @@ namespace sw
unsigned int attribType : BITS(SpirvShader::ATTRIBTYPE_LAST);
};
Input input[MAX_VERTEX_INPUTS];
Input input[MAX_INTERFACE_COMPONENTS / 4];
};
struct State : States
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment