gl_FragCoord support.
This commit is contained in:
@@ -195,6 +195,7 @@ bool DrawBatcher::BeginDraw() {
|
||||
auto state_host_ptr =
|
||||
reinterpret_cast<uintptr_t>(active_draw_.state_allocation.host_ptr);
|
||||
active_draw_.header = reinterpret_cast<CommonHeader*>(state_host_ptr);
|
||||
active_draw_.header->ps_param_gen = -1;
|
||||
// active_draw_.float_consts =
|
||||
// reinterpret_cast<float4*>(state_host_ptr +
|
||||
// batch_state_.float_consts_offset);
|
||||
|
||||
@@ -75,6 +75,9 @@ class DrawBatcher {
|
||||
active_draw_.header->alpha_test.y = static_cast<float>(func);
|
||||
active_draw_.header->alpha_test.z = ref;
|
||||
}
|
||||
void set_ps_param_gen(int register_index) {
|
||||
active_draw_.header->ps_param_gen = register_index;
|
||||
}
|
||||
void set_texture_sampler(int index, GLuint64 handle) {
|
||||
active_draw_.header->texture_samplers[index] = handle;
|
||||
}
|
||||
@@ -132,6 +135,8 @@ class DrawBatcher {
|
||||
float4 window_scale; // sx,sy, ?, ?
|
||||
float4 vtx_fmt; //
|
||||
float4 alpha_test; // alpha test enable, func, ref, ?
|
||||
int ps_param_gen;
|
||||
int padding[3];
|
||||
|
||||
// TODO(benvanik): pack tightly
|
||||
GLuint64 texture_samplers[32];
|
||||
|
||||
@@ -623,6 +623,7 @@ GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateShaders(
|
||||
dirty |= SetShadowRegister(®s.pa_su_sc_mode_cntl,
|
||||
XE_GPU_REG_PA_SU_SC_MODE_CNTL);
|
||||
dirty |= SetShadowRegister(®s.sq_program_cntl, XE_GPU_REG_SQ_PROGRAM_CNTL);
|
||||
dirty |= SetShadowRegister(®s.sq_context_misc, XE_GPU_REG_SQ_CONTEXT_MISC);
|
||||
dirty |= regs.vertex_shader != active_vertex_shader_;
|
||||
dirty |= regs.pixel_shader != active_pixel_shader_;
|
||||
dirty |= regs.prim_type != prim_type;
|
||||
@@ -640,6 +641,10 @@ GL4CommandProcessor::UpdateStatus GL4CommandProcessor::UpdateShaders(
|
||||
xe_gpu_program_cntl_t program_cntl;
|
||||
program_cntl.dword_0 = regs.sq_program_cntl;
|
||||
|
||||
// Populate a register in the pixel shader with frag coord.
|
||||
int ps_param_gen = (regs.sq_context_misc >> 8) & 0xFF;
|
||||
draw_batcher_.set_ps_param_gen(program_cntl.param_gen ? ps_param_gen : -1);
|
||||
|
||||
// Normal vertex shaders only, for now.
|
||||
// TODO(benvanik): transform feedback/memexport.
|
||||
// 0 = normal
|
||||
|
||||
@@ -213,6 +213,7 @@ class GL4CommandProcessor : public CommandProcessor {
|
||||
PrimitiveType prim_type;
|
||||
uint32_t pa_su_sc_mode_cntl;
|
||||
uint32_t sq_program_cntl;
|
||||
uint32_t sq_context_misc;
|
||||
GL4Shader* vertex_shader;
|
||||
GL4Shader* pixel_shader;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user