virgl: Return an error if we use fp64 on top of GLES
Signed-off-by: Elie Tournier <elie.tournier@collabora.com> Reviewed-by: <Gurchetan Singh gurchetansingh@chromium.org>
This commit is contained in:
committed by
Gert Wollny
parent
1f1514e1aa
commit
d7b3196976
@@ -25,13 +25,17 @@
|
|||||||
so add a transform stage to remove things we don't want to send unless
|
so add a transform stage to remove things we don't want to send unless
|
||||||
the receiver supports it.
|
the receiver supports it.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "tgsi/tgsi_transform.h"
|
#include "tgsi/tgsi_transform.h"
|
||||||
|
#include "tgsi/tgsi_info.h"
|
||||||
#include "virgl_context.h"
|
#include "virgl_context.h"
|
||||||
#include "virgl_screen.h"
|
#include "virgl_screen.h"
|
||||||
|
|
||||||
struct virgl_transform_context {
|
struct virgl_transform_context {
|
||||||
struct tgsi_transform_context base;
|
struct tgsi_transform_context base;
|
||||||
bool cull_enabled;
|
bool cull_enabled;
|
||||||
bool has_precise;
|
bool has_precise;
|
||||||
|
bool fake_fp64;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -78,6 +82,13 @@ virgl_tgsi_transform_instruction(struct tgsi_transform_context *ctx,
|
|||||||
struct tgsi_full_instruction *inst)
|
struct tgsi_full_instruction *inst)
|
||||||
{
|
{
|
||||||
struct virgl_transform_context *vtctx = (struct virgl_transform_context *)ctx;
|
struct virgl_transform_context *vtctx = (struct virgl_transform_context *)ctx;
|
||||||
|
if (vtctx->fake_fp64 &&
|
||||||
|
(tgsi_opcode_infer_src_type(inst->Instruction.Opcode, 0) == TGSI_TYPE_DOUBLE ||
|
||||||
|
tgsi_opcode_infer_dst_type(inst->Instruction.Opcode, 0) == TGSI_TYPE_DOUBLE)) {
|
||||||
|
fprintf(stderr, "ARB_gpu_shader_fp64 is exposed but not supported.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!vtctx->has_precise && inst->Instruction.Precise)
|
if (!vtctx->has_precise && inst->Instruction.Precise)
|
||||||
inst->Instruction.Precise = 0;
|
inst->Instruction.Precise = 0;
|
||||||
|
|
||||||
@@ -107,6 +118,8 @@ struct tgsi_token *virgl_tgsi_transform(struct virgl_context *vctx, const struct
|
|||||||
transform.base.transform_instruction = virgl_tgsi_transform_instruction;
|
transform.base.transform_instruction = virgl_tgsi_transform_instruction;
|
||||||
transform.cull_enabled = vscreen->caps.caps.v1.bset.has_cull;
|
transform.cull_enabled = vscreen->caps.caps.v1.bset.has_cull;
|
||||||
transform.has_precise = vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_TGSI_PRECISE;
|
transform.has_precise = vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_TGSI_PRECISE;
|
||||||
|
transform.fake_fp64 =
|
||||||
|
vscreen->caps.caps.v2.capability_bits & VIRGL_CAP_FAKE_FP64;
|
||||||
tgsi_transform_shader(tokens_in, new_tokens, newLen, &transform.base);
|
tgsi_transform_shader(tokens_in, new_tokens, newLen, &transform.base);
|
||||||
|
|
||||||
return new_tokens;
|
return new_tokens;
|
||||||
|
|||||||
Reference in New Issue
Block a user