mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-31 06:32:41 +00:00
d3d12: Add a swizzle to texture
Looks like shader4componentmapping doesnt work, maybe a bug.
This commit is contained in:
parent
3a75e6a357
commit
1f9c8f757a
@ -649,7 +649,17 @@ void D3D12GSRender::ExecCMD()
|
||||
auto pixels = vm::get_ptr<const u8>(texaddr);
|
||||
void *textureData;
|
||||
check(Texture->Map(0, nullptr, (void**)&textureData));
|
||||
std::vector<u8> texdata;
|
||||
texdata.resize(textureSize);
|
||||
memcpy(textureData, pixels, textureSize);
|
||||
memcpy(texdata.data(), pixels, textureSize);
|
||||
for (unsigned i = 0; i < textureSize / 4; i++)
|
||||
{
|
||||
// ((char*)textureData)[4 * i] = ((char*)textureData)[4 * i + 1];// *(i % 2);
|
||||
// ((char*)textureData)[4 * i + 1] = 255 *(i % 2);
|
||||
// ((char*)textureData)[4 * i + 2] = ((char*)textureData)[4 * i + 1];// *(i % 2);
|
||||
// ((char*)textureData)[4 * i + 3] = ((char*)textureData)[4 * i + 1];// *(i % 2);
|
||||
}
|
||||
Texture->Unmap(0, nullptr);
|
||||
|
||||
D3D12_RESOURCE_DESC vramTextureDesc = {};
|
||||
@ -695,7 +705,7 @@ void D3D12GSRender::ExecCMD()
|
||||
srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
|
||||
srvDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
|
||||
srvDesc.Texture2D.MipLevels = 1;
|
||||
srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
|
||||
srvDesc.Shader4ComponentMapping = D3D12_ENCODE_SHADER_4_COMPONENT_MAPPING(D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0, D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0, D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0, D3D12_SHADER_COMPONENT_MAPPING_FROM_MEMORY_COMPONENT_0);
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE Handle = m_textureDescriptorsHeap->GetCPUDescriptorHandleForHeapStart();
|
||||
Handle.ptr += (m_currentTextureIndex + usedTexture) * m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
|
||||
m_device->CreateShaderResourceView(vramTexture, &srvDesc, Handle);
|
||||
|
@ -67,6 +67,7 @@ struct D3D12Traits
|
||||
|
||||
for (const ParamType& PT : FS.m_parr.params[PF_PARAM_UNIFORM])
|
||||
{
|
||||
if (PT.type == "sampler2D") continue;
|
||||
for (const ParamItem PI : PT.items)
|
||||
{
|
||||
size_t offset = atoi(PI.name.c_str() + 2);
|
||||
|
@ -630,7 +630,7 @@ std::string FragmentDecompiler::Decompile()
|
||||
case RSX_FP_OPCODE_DDY: SetDst("dFdy($0)"); break;
|
||||
case RSX_FP_OPCODE_NRM: SetDst("normalize($0)"); break;
|
||||
case RSX_FP_OPCODE_BEM: LOG_ERROR(RSX, "Unimplemented TEX_SRB instruction: BEM"); break;
|
||||
case RSX_FP_OPCODE_TEX: SetDst("$t.Sample($tsampler, $0.xy)"); break;
|
||||
case RSX_FP_OPCODE_TEX: SetDst("$t.Sample($tsampler, $0.xy).yzwx"); break;
|
||||
case RSX_FP_OPCODE_TEXBEM: SetDst("texture($t, $0.xy, $1.x)"); break;
|
||||
case RSX_FP_OPCODE_TXP: SetDst("textureProj($t, $0.xyz, $1.x)"); break; //TODO: More testing (Sonic The Hedgehog (NPUB-30442/NPEB-00478) and The Simpsons Arcade Game (NPUB30563))
|
||||
case RSX_FP_OPCODE_TXPBEM: SetDst("textureProj($t, $0.xyz, $1.x)"); break;
|
||||
|
@ -565,7 +565,7 @@ void VertexDecompiler::insertMainEnd(std::stringstream & OS)
|
||||
OS << " Out." << i.src_reg << " = " << i.src_reg << ";" << std::endl;
|
||||
}
|
||||
// TODO: Find why I need to do this
|
||||
OS << " Out.dst_reg0.z *= -1.;" << std::endl;
|
||||
// OS << " Out.dst_reg0.z *= -1.;" << std::endl;
|
||||
OS << " Out.dst_reg0 = mul(Out.dst_reg0, scaleOffsetMat);" << std::endl;
|
||||
OS << " return Out;" << std::endl;
|
||||
OS << "}" << std::endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user