0
votes

I have been trying to implement a Yuv422 to RGB pixel shader conversion in SDL_render_d3d.c. I am unable to get the same format of compiled code used in this, an array const DWORD shader_data[] is used and this works fine but is a 420 converter, the source code and assembler are listed along with the command line needed to compile the source to assembler.

When I use fxc to compile a shader (.hlsl) i get a header file with byte code in it starting with 'DXBC' which as I understand it from lots of googling is the prefix for hlsl byte code. I have also tried doing a compile from file at run time which also creates a buffer containing the same.

When I try and create a PixelShader from this it fails with code 0x8876086c,

Does anyone know how to create the DWORD formatted ready to use format? this would seem to be the simplest way to move ahead

Working format:

    const DWORD shader_data[] = {
        0xffff0200, 0x05000051, 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081,
        ....... };

fxc generated format that does not work:

const BYTE g_YuvToRgb[] =
{
     68,  88,  66,  67,  25, 203, 
     28,  33,  88, 181, 245, 169,
     ...... }; 
1

1 Answers

0
votes

There is no real reason to keep shader as array of DWORD, just cast a pointer to buffer with shader to DWORD * and make sure that buffer size is multiple to sizeof(DWORD) (which it should be). Error code 0x8876086c is D3DERR_INVALIDCALL so probably your compiled shader is not usable for some reason. How do you compile it? Have you specified required shader model?