diff --git a/libraries/libgfd/src/gfd.c b/libraries/libgfd/src/gfd.c index a934f83..df192e9 100644 --- a/libraries/libgfd/src/gfd.c +++ b/libraries/libgfd/src/gfd.c @@ -799,6 +799,7 @@ GFDGetGX2RTexture(GX2Texture *texture, GX2RCreateSurface(&texture->surface, GX2R_RESOURCE_BIND_TEXTURE + | GX2R_RESOURCE_USAGE_CPU_READ | GX2R_RESOURCE_USAGE_CPU_WRITE | GX2R_RESOURCE_USAGE_GPU_READ); diff --git a/libraries/libwhb/src/gfx_shader.c b/libraries/libwhb/src/gfx_shader.c index eb57f7d..a3bfe18 100644 --- a/libraries/libwhb/src/gfx_shader.c +++ b/libraries/libwhb/src/gfx_shader.c @@ -42,7 +42,10 @@ WHBGfxLoadGFDPixelShader(uint32_t index, goto error; } - shader->gx2rBuffer.flags = GX2R_RESOURCE_BIND_SHADER_PROGRAM | GX2R_RESOURCE_USAGE_CPU_WRITE | GX2R_RESOURCE_USAGE_GPU_READ; + shader->gx2rBuffer.flags = GX2R_RESOURCE_BIND_SHADER_PROGRAM | + GX2R_RESOURCE_USAGE_CPU_READ | + GX2R_RESOURCE_USAGE_CPU_WRITE | + GX2R_RESOURCE_USAGE_GPU_READ; shader->gx2rBuffer.elemSize = programSize; shader->gx2rBuffer.elemCount = 1; shader->gx2rBuffer.buffer = NULL; @@ -64,6 +67,10 @@ WHBGfxLoadGFDPixelShader(uint32_t index, } GX2RUnlockBufferEx(&shader->gx2rBuffer, 0); + + // For some reason we still need to manually invalidate the buffers, + // even though GX2RUnlockBuffer SHOULD be doing that for us + GX2Invalidate(GX2_INVALIDATE_MODE_CPU_SHADER, shader->program, shader->size); return shader; error: @@ -122,7 +129,10 @@ WHBGfxLoadGFDVertexShader(uint32_t index, goto error; } - shader->gx2rBuffer.flags = GX2R_RESOURCE_BIND_SHADER_PROGRAM | GX2R_RESOURCE_USAGE_CPU_WRITE | GX2R_RESOURCE_USAGE_GPU_READ; + shader->gx2rBuffer.flags = GX2R_RESOURCE_BIND_SHADER_PROGRAM | + GX2R_RESOURCE_USAGE_CPU_READ | + GX2R_RESOURCE_USAGE_CPU_WRITE | + GX2R_RESOURCE_USAGE_GPU_READ; shader->gx2rBuffer.elemSize = programSize; shader->gx2rBuffer.elemCount = 1; shader->gx2rBuffer.buffer = NULL; @@ -144,6 +154,10 @@ WHBGfxLoadGFDVertexShader(uint32_t index, } GX2RUnlockBufferEx(&shader->gx2rBuffer, 0); + + // For some reason we still need to manually invalidate the buffers, + // even though GX2RUnlockBuffer SHOULD be doing that for us + GX2Invalidate(GX2_INVALIDATE_MODE_CPU_SHADER, shader->program, shader->size); return shader; error: