Removing fetch consts from state data.

This commit is contained in:
Ben Vanik 2015-01-03 13:59:31 -08:00
parent 2a082ff242
commit 56a04592d5
2 changed files with 23 additions and 17 deletions

View File

@ -1646,7 +1646,8 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateViewportState(
state_data->window_offset.x = float(window_offset & 0x7FFF);
state_data->window_offset.y = float((window_offset >> 16) & 0x7FFF);
} else {
state_data->window_offset.x = state_data->window_offset.y = 0;
state_data->window_offset.x = 0;
state_data->window_offset.y = 0;
}
uint32_t window_scissor_tl = regs[XE_GPU_REG_PA_SC_WINDOW_SCISSOR_TL].u32;
uint32_t window_scissor_br = regs[XE_GPU_REG_PA_SC_WINDOW_SCISSOR_BR].u32;
@ -1986,10 +1987,13 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateConstants(
// down on state block sizes.
// Copy over all constants.
std::memcpy(&state_data->float_consts,
&regs[XE_GPU_REG_SHADER_CONSTANT_000_X].f32,
sizeof(state_data->float_consts));
std::memcpy(
&state_data->float_consts, &regs[XE_GPU_REG_SHADER_CONSTANT_000_X].f32,
sizeof(state_data->float_consts) + sizeof(state_data->fetch_consts) +
sizeof(state_data->loop_consts) + sizeof(state_data->bool_consts));
&state_data->bool_consts,
&regs[XE_GPU_REG_SHADER_CONSTANT_BOOL_000_031].f32,
sizeof(state_data->bool_consts) + sizeof(state_data->loop_consts));
return UpdateStatus::kCompatible;
}

View File

@ -59,21 +59,22 @@ struct UniformDataBlock {
float4 alpha_test; // alpha test enable, func, ref, ?
// TODO(benvanik): overlay with fetch_consts below?
// TODO(benvanik): pack tightly
uint64_t texture_samplers[32];
// Register data from 0x4000 to 0x4927.
// UpdateConstants relies on the packing of these.
struct {
// SHADER_CONSTANT_000_X...
float4 float_consts[512];
// SHADER_CONSTANT_FETCH_00_0...
uint32_t fetch_consts[32 * 6];
// SHADER_CONSTANT_FETCH_00_0 is omitted
// SHADER_CONSTANT_BOOL_000_031...
int32_t bool_consts[8];
// SHADER_CONSTANT_LOOP_00...
int32_t loop_consts[32];
};
static_assert(sizeof(UniformDataBlock) <= 16 * 1024,
"Need <=16k uniform data");
};
static_assert(sizeof(UniformDataBlock) <= 16 * 1024, "Need <=16k uniform data");
// TODO(benvanik): move more of the enums in here?
struct DrawCommand {
@ -103,6 +104,7 @@ struct DrawCommand {
SamplerInput vertex_shader_samplers[32];
SamplerInput pixel_shader_samplers[32];
// NOTE: do not read from this - the mapped memory is likely write combined.
UniformDataBlock* state_data;
};