Skeleton for new draw type and texture fetching.
This commit is contained in:
parent
3fd8bd20b5
commit
889e586cab
|
@ -101,6 +101,13 @@ void D3D11GraphicsDriver::SetShader(
|
|||
}
|
||||
}
|
||||
|
||||
void D3D11GraphicsDriver::DrawIndexBuffer(
|
||||
XE_GPU_PRIMITIVE_TYPE prim_type,
|
||||
bool index_32bit, uint32_t index_count,
|
||||
uint32_t index_base, uint32_t index_size, uint32_t endianness) {
|
||||
XELOGGPU("D3D11: draw index buffer");
|
||||
}
|
||||
|
||||
void D3D11GraphicsDriver::DrawIndexAuto(
|
||||
XE_GPU_PRIMITIVE_TYPE prim_type,
|
||||
uint32_t index_count) {
|
||||
|
|
|
@ -42,6 +42,10 @@ public:
|
|||
uint32_t address,
|
||||
uint32_t start,
|
||||
uint32_t length);
|
||||
virtual void DrawIndexBuffer(
|
||||
xenos::XE_GPU_PRIMITIVE_TYPE prim_type,
|
||||
bool index_32bit, uint32_t index_count,
|
||||
uint32_t index_base, uint32_t index_size, uint32_t endianness);
|
||||
virtual void DrawIndexAuto(
|
||||
xenos::XE_GPU_PRIMITIVE_TYPE prim_type,
|
||||
uint32_t index_count);
|
||||
|
|
|
@ -1173,6 +1173,13 @@ int TranslateVertexFetch(
|
|||
return 0;
|
||||
}
|
||||
|
||||
int TranslateTextureFetch(
|
||||
xe_gpu_translate_ctx_t& ctx, const instr_fetch_tex_t* tex, int sync) {
|
||||
Output* output = ctx.output;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct {
|
||||
const char *name;
|
||||
} cf_instructions[] = {
|
||||
|
@ -1237,6 +1244,10 @@ int D3D11Shader::TranslateExec(xe_gpu_translate_ctx_t& ctx, const instr_cf_exec_
|
|||
}
|
||||
break;
|
||||
case TEX_FETCH:
|
||||
if (TranslateTextureFetch(ctx, &fetch->tex, sync)) {
|
||||
return 1;
|
||||
}
|
||||
break;
|
||||
case TEX_GET_BORDER_COLOR_FRAC:
|
||||
case TEX_GET_COMP_TEX_LOD:
|
||||
case TEX_GET_GRADIENTS:
|
||||
|
|
|
@ -38,7 +38,10 @@ public:
|
|||
uint32_t address,
|
||||
uint32_t start,
|
||||
uint32_t length) = 0;
|
||||
//virtual void DrawIndex();
|
||||
virtual void DrawIndexBuffer(
|
||||
xenos::XE_GPU_PRIMITIVE_TYPE prim_type,
|
||||
bool index_32bit, uint32_t index_count,
|
||||
uint32_t index_base, uint32_t index_size, uint32_t endianness) = 0;
|
||||
//virtual void DrawIndexImmediate();
|
||||
virtual void DrawIndexAuto(
|
||||
xenos::XE_GPU_PRIMITIVE_TYPE prim_type,
|
||||
|
|
|
@ -63,6 +63,13 @@ void NopGraphicsDriver::SetShader(
|
|||
type, address, length, source);
|
||||
}
|
||||
|
||||
void NopGraphicsDriver::DrawIndexBuffer(
|
||||
XE_GPU_PRIMITIVE_TYPE prim_type,
|
||||
bool index_32bit, uint32_t index_count,
|
||||
uint32_t index_base, uint32_t index_size, uint32_t endianness) {
|
||||
XELOGGPU("NOP: draw index buffer");
|
||||
}
|
||||
|
||||
void NopGraphicsDriver::DrawIndexAuto(
|
||||
XE_GPU_PRIMITIVE_TYPE prim_type,
|
||||
uint32_t index_count) {
|
||||
|
|
|
@ -39,6 +39,10 @@ public:
|
|||
uint32_t address,
|
||||
uint32_t start,
|
||||
uint32_t length);
|
||||
virtual void DrawIndexBuffer(
|
||||
xenos::XE_GPU_PRIMITIVE_TYPE prim_type,
|
||||
bool index_32bit, uint32_t index_count,
|
||||
uint32_t index_base, uint32_t index_size, uint32_t endianness);
|
||||
virtual void DrawIndexAuto(
|
||||
xenos::XE_GPU_PRIMITIVE_TYPE prim_type,
|
||||
uint32_t index_count);
|
||||
|
|
|
@ -502,10 +502,23 @@ uint32_t RingBufferWorker::ExecutePacket(PacketArgs& args) {
|
|||
uint32_t index_count = d1 >> 16;
|
||||
uint32_t prim_type = d1 & 0x3F;
|
||||
uint32_t src_sel = (d1 >> 6) & 0x3;
|
||||
XEASSERT(src_sel == 0x2); // 'SrcSel=AutoIndex'
|
||||
driver_->DrawIndexAuto(
|
||||
(XE_GPU_PRIMITIVE_TYPE)prim_type,
|
||||
index_count);
|
||||
if (src_sel == 0x0) {
|
||||
uint32_t index_base = READ_AND_ADVANCE_PTR();
|
||||
uint32_t index_size = READ_AND_ADVANCE_PTR();
|
||||
uint32_t endianness = index_size >> 29;
|
||||
index_size &= 0x00FFFFFF;
|
||||
bool index_32bit = (d1 >> 11) & 0x1;
|
||||
driver_->DrawIndexBuffer(
|
||||
(XE_GPU_PRIMITIVE_TYPE)prim_type,
|
||||
index_32bit, index_count, index_base, index_size, endianness);
|
||||
} else if (src_sel == 0x2) {
|
||||
driver_->DrawIndexAuto(
|
||||
(XE_GPU_PRIMITIVE_TYPE)prim_type,
|
||||
index_count);
|
||||
} else {
|
||||
// Unknown source select.
|
||||
XEASSERTALWAYS();
|
||||
}
|
||||
}
|
||||
break;
|
||||
case PM4_DRAW_INDX_2:
|
||||
|
|
|
@ -112,6 +112,8 @@ void Shader::GatherExec(const instr_cf_exec_t* cf) {
|
|||
GatherVertexFetch(&fetch->vtx);
|
||||
break;
|
||||
case TEX_FETCH:
|
||||
GatherTextureFetch(&fetch->tex);
|
||||
break;
|
||||
case TEX_GET_BORDER_COLOR_FRAC:
|
||||
case TEX_GET_COMP_TEX_LOD:
|
||||
case TEX_GET_GRADIENTS:
|
||||
|
@ -153,3 +155,9 @@ void Shader::GatherVertexFetch(const instr_fetch_vtx_t* vtx) {
|
|||
const instr_fetch_vtx_t* Shader::GetFetchVtxBySlot(uint32_t fetch_slot) {
|
||||
return &fetch_vtx_slots_[fetch_slot];
|
||||
}
|
||||
|
||||
void Shader::GatherTextureFetch(const xenos::instr_fetch_tex_t* tex) {
|
||||
fetch_texs_.push_back(*tex);
|
||||
|
||||
// slots
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ private:
|
|||
void GatherAlloc(const xenos::instr_cf_alloc_t* cf);
|
||||
void GatherExec(const xenos::instr_cf_exec_t* cf);
|
||||
void GatherVertexFetch(const xenos::instr_fetch_vtx_t* vtx);
|
||||
void GatherTextureFetch(const xenos::instr_fetch_tex_t* tex);
|
||||
|
||||
protected:
|
||||
xenos::XE_GPU_SHADER_TYPE type_;
|
||||
|
@ -63,6 +64,7 @@ protected:
|
|||
std::vector<xenos::instr_cf_alloc_t> allocs_;
|
||||
std::vector<xenos::instr_fetch_vtx_t> fetch_vtxs_;
|
||||
xenos::instr_fetch_vtx_t fetch_vtx_slots_[96];
|
||||
std::vector<xenos::instr_fetch_tex_t> fetch_texs_;
|
||||
};
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue