1473{
1475 uint32_t offset, cbuffer_offset, resource_offset, creator_offset;
1476 unsigned int i, string_data_offset, string_data_size;
1478 char *string_data =
NULL, *creator =
NULL;
1479 size_t size = data_size >> 2;
1482#if D3D_COMPILER_VERSION < 47
1484#endif
1486
1488
1490 TRACE(
"Constant buffer count: %u.\n",
r->constant_buffer_count);
1491
1493 TRACE(
"Constant buffer offset: %#x.\n", cbuffer_offset);
1494
1496 TRACE(
"Bound resource count: %u.\n",
r->bound_resource_count);
1497
1499 TRACE(
"Bound resource offset: %#x.\n", resource_offset);
1500
1502 TRACE(
"Target: %#x.\n",
r->target);
1503
1505#if D3D_COMPILER_VERSION < 47
1510 {
1513 }
1514#endif
1515
1517 TRACE(
"Flags: %u.\n",
r->flags);
1518
1520 TRACE(
"Creator at offset %#x.\n", creator_offset);
1521
1523 {
1524 ERR(
"Failed to copy name.\n");
1526 }
1528
1529
1530 if (target_version >= 0x500)
1531 {
1533 }
1534
1535 if (
r->bound_resource_count)
1536 {
1537
1538 string_data_offset = resource_offset +
r->bound_resource_count * 8 *
sizeof(
uint32_t);
1539 string_data_size = (cbuffer_offset ? cbuffer_offset : creator_offset) - string_data_offset;
1540
1541 string_data =
malloc(string_data_size);
1542 if (!string_data)
1543 {
1544 ERR(
"Failed to allocate string data memory.\n");
1546 goto err_out;
1547 }
1548 memcpy(string_data,
data + string_data_offset, string_data_size);
1549
1550 bound_resources =
calloc(
r->bound_resource_count,
sizeof(*bound_resources));
1551 if (!bound_resources)
1552 {
1553 ERR(
"Failed to allocate resources memory.\n");
1555 goto err_out;
1556 }
1557
1559 for (
i = 0;
i <
r->bound_resource_count;
i++)
1560 {
1562
1566
1568 TRACE(
"Input bind Type: %#x.\n",
desc->Type);
1569
1571 TRACE(
"Input bind ReturnType: %#x.\n",
desc->ReturnType);
1572
1574 TRACE(
"Input bind Dimension: %#x.\n",
desc->Dimension);
1575
1577 TRACE(
"Input bind NumSamples: %u.\n",
desc->NumSamples);
1578
1580 TRACE(
"Input bind BindPoint: %u.\n",
desc->BindPoint);
1581
1583 TRACE(
"Input bind BindCount: %u.\n",
desc->BindCount);
1584
1587
1588 if (target_version >= 0x501)
1589 {
1591 TRACE(
"Input bind Space %u.\n",
desc->Space);
1593 TRACE(
"Input bind uID %u.\n",
desc->uID);
1594 }
1595 else
1596 {
1598 }
1599 }
1600 }
1601
1602 if (
r->constant_buffer_count)
1603 {
1604 constant_buffers =
calloc(
r->constant_buffer_count,
sizeof(*constant_buffers));
1605 if (!constant_buffers)
1606 {
1607 ERR(
"Failed to allocate constant buffer memory.\n");
1609 goto err_out;
1610 }
1611
1613 for (
i = 0;
i <
r->constant_buffer_count;
i++)
1614 {
1616
1619
1622 {
1623 ERR(
"Failed to copy name.\n");
1625 goto err_out;
1626 }
1628
1630 TRACE(
"Variable count: %u.\n",
cb->variable_count);
1631
1634
1637 {
1638 FIXME(
"Failed to parse variables.\n");
1639 goto err_out;
1640 }
1641
1643 TRACE(
"Cbuffer size: %u.\n",
cb->size);
1644
1646 TRACE(
"Cbuffer flags: %u.\n",
cb->flags);
1647
1649 TRACE(
"Cbuffer type: %#x.\n",
cb->type);
1650 }
1651 }
1652
1653 r->creator = creator;
1654 r->resource_string = string_data;
1655 r->bound_resources = bound_resources;
1656 r->constant_buffers = constant_buffers;
1657
1659
1660err_out:
1661 for (
i = 0;
i <
r->constant_buffer_count; ++
i)
1662 {
1664 }
1665 free(constant_buffers);
1666 free(bound_resources);
1669
1671}
#define D3D_COMPILER_VERSION
#define D3DCOMPILER_SHADER_TARGET_SHADERTYPE_SHIFT
#define D3DCOMPILER_SHADER_TARGET_SHADERTYPE_MASK
#define D3DCOMPILER_SHADER_TARGET_VERSION_MASK
static const struct ID3D11ShaderReflectionConstantBufferVtbl d3dcompiler_shader_reflection_constant_buffer_vtbl
static HRESULT d3dcompiler_parse_variables(struct d3dcompiler_shader_reflection_constant_buffer *cb, const char *data, size_t data_size, const char *ptr)
static void free_constant_buffer(struct d3dcompiler_shader_reflection_constant_buffer *cb)
static BOOL copy_name(const char *ptr, char **name)
#define D3DCOMPILER_SHDR_SHADER_TYPE_CS
void skip_u32_unknown(const char **ptr, unsigned int count)
static uint32_t read_u32(const char **ptr)
GLdouble GLdouble GLdouble r
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
D3D11_SHADER_VARIABLE_DESC desc